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. General Programming
  3. C#
  4. insert into error

insert into error

Scheduled Pinned Locked Moved C#
databasehelpquestion
3 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.
  • S Offline
    S Offline
    Susuko
    wrote on last edited by
    #1

    i've create a simple access database with a table: ID (int counter *) Name (string *) Surname (string) Age (int) Memo (memo) why if i do this: ... conn.Open(); OleDbDataAdapter oleDa = new OleDbDataAdapter("Select * from myTable", conn); OleDbCommand cmdInsert = new OleDbCommand(); cmdInsert.CommandText = "Insert into TableNotes (Name, Memo) Values (?,?)"; cmdInsert.Connection = conn; cmdInsert.Parameters.Add(new OleDbParameter("Name", OleDbType.VarChar, 20)); cmdInsert.Parameters.Add(new OleDbParameter("Memo", OleDbType.WChar)); cmdInsert.Parameters[0].Value = Name; cmdInsert.Parameters[1].Value = textBox1.Text; oleDa.InsertCommand = cmdInsert; cmdInsert.ExecuteNonQuery(); i get error in "insert into query"? if i try to insert just Name it works!

    S 1 Reply Last reply
    0
    • S Susuko

      i've create a simple access database with a table: ID (int counter *) Name (string *) Surname (string) Age (int) Memo (memo) why if i do this: ... conn.Open(); OleDbDataAdapter oleDa = new OleDbDataAdapter("Select * from myTable", conn); OleDbCommand cmdInsert = new OleDbCommand(); cmdInsert.CommandText = "Insert into TableNotes (Name, Memo) Values (?,?)"; cmdInsert.Connection = conn; cmdInsert.Parameters.Add(new OleDbParameter("Name", OleDbType.VarChar, 20)); cmdInsert.Parameters.Add(new OleDbParameter("Memo", OleDbType.WChar)); cmdInsert.Parameters[0].Value = Name; cmdInsert.Parameters[1].Value = textBox1.Text; oleDa.InsertCommand = cmdInsert; cmdInsert.ExecuteNonQuery(); i get error in "insert into query"? if i try to insert just Name it works!

      S Offline
      S Offline
      Shajeel
      wrote on last edited by
      #2

      try to change the name of the column Memo to something else, because may be it is conflicting with the keyword for creating Memo type column, once i have a column name DateTime and it was not functioning as well, when in changed the name to scheduledDateTime it worked. Regards Shajeel

      S 1 Reply Last reply
      0
      • S Shajeel

        try to change the name of the column Memo to something else, because may be it is conflicting with the keyword for creating Memo type column, once i have a column name DateTime and it was not functioning as well, when in changed the name to scheduledDateTime it worked. Regards Shajeel

        S Offline
        S Offline
        Susuko
        wrote on last edited by
        #3

        yes!!!! tnx

        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