insert into error
-
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!
-
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!
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
-
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