S
SteMc
I have a slight problem updating a table in a database (vb.net)
my code looks like the following
Dim new_row As DataRow = {datatable}.NewRow
..
..
..
//the following are the only columns in my table//
line 1: new_row("coming_from") = "1000"
line 2: new_row("text") = "blah blah blah"
line 3: new_row("going_to") = "-1"
line 4: new_row("solution") = true
line 5: new_row("q_a_s") = "answer"
line 6: {data_table}.Rows.Add(new_row)
line 7: {data_adapter}.Update(data_table)***
This is where I am having a problem (Line 7). My database has about 5
tables and all of them have been updated in some fashion, all in this
exact manner and have worked perfectly - but this one won't.
I've checked the datatable in the command window after line 6 has
completed and the new row has been added and all the data is correct.
However when the prog reaches line 7 it gives the following error
message:
"An unhandled exception of type 'System.Data.OleDb.OleDbException'
occurred in System.data.dll"
When I use the command window and type in "?
{data_adapter}.Update(data_table)" I get the following message:
"Run-time exception thrown : System.Data.OleDb.OleDbException - Syntax
error in INSERT INTO statement."
What this means I just do not know and am hoping that somebody here can
help me?
As I've used the same method of code as when trying to update other
tables I assumed it should work but it just doesn't want to
thanks,
Steve
my code looks like the following
Dim new_row As DataRow = {datatable}.NewRow
..
..
..
//the following are the only columns in my table//
line 1: new_row("coming_from") = "1000"
line 2: new_row("text") = "blah blah blah"
line 3: new_row("going_to") = "-1"
line 4: new_row("solution") = true
line 5: new_row("q_a_s") = "answer"
line 6: {data_table}.Rows.Add(new_row)
line 7: {data_adapter}.Update(data_table)***
This is where I am having a problem (Line 7). My database has about 5
tables and all of them have been updated in some fashion, all in this
exact manner and have worked perfectly - but this one won't.
I've checked the datatable in the command window after line 6 has
completed and the new row has been added and all the data is correct.
However when the prog reaches line 7 it gives the following error
message:
"An unhandled exception of type 'System.Data.OleDb.OleDbException'
occurred in System.data.dll"
When I use the command window and type in "?
{data_adapter}.Update(data_table)" I get the following message:
"Run-time exception thrown : System.Data.OleDb.OleDbException - Syntax
error in INSERT INTO statement."
What this means I just do not know and am hoping that somebody here can
help me?
As I've used the same method of code as when trying to update other
tables I assumed it should work but it just doesn't want to
thanks,
Steve