Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. populating Access table field with charater variable

populating Access table field with charater variable

Scheduled Pinned Locked Moved Database
helpcsharpjava
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Amanjot
    wrote on last edited by
    #1

    I am an oldy trying out some stuff with VB.net - Access coding. My code is almost complete; however, I am having an error populating a charater field. There are five fields in the table seasonNo [integer], sYear [integer], seasObs [double], seasSim [double], and season [char]. In the season field I want to write season of the year. However, with the code below if I replace 1 (last field in cmd line) with sea(im) or eg. "winter", the command gives error. There is no error if it is 1. Any help to remove the error will be greatly appreciated. Dim sea() As String = {"Winter", "Spring", "Summar", "Fall"} For ir = 0 To ty - 1 imYear = minYear + ir For im = 1 To 4 cmd = "insert into seasonSummary VALUES (" & im & " , " & imYear " , " seasObs(im, ir) & " , " & seasSim(im, ir) & " , " & 1 & ")" dbCmd = New OleDbCommand(cmd, myConnection) dbCmd.ExecuteScalar() Next Next

    C 1 Reply Last reply
    0
    • A Amanjot

      I am an oldy trying out some stuff with VB.net - Access coding. My code is almost complete; however, I am having an error populating a charater field. There are five fields in the table seasonNo [integer], sYear [integer], seasObs [double], seasSim [double], and season [char]. In the season field I want to write season of the year. However, with the code below if I replace 1 (last field in cmd line) with sea(im) or eg. "winter", the command gives error. There is no error if it is 1. Any help to remove the error will be greatly appreciated. Dim sea() As String = {"Winter", "Spring", "Summar", "Fall"} For ir = 0 To ty - 1 imYear = minYear + ir For im = 1 To 4 cmd = "insert into seasonSummary VALUES (" & im & " , " & imYear " , " seasObs(im, ir) & " , " & seasSim(im, ir) & " , " & 1 & ")" dbCmd = New OleDbCommand(cmd, myConnection) dbCmd.ExecuteScalar() Next Next

      C Offline
      C Offline
      ChandraRam
      wrote on last edited by
      #2

      What's the structure of the seasonSummary table? What's the error message you get?

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups