SQL Error (1 Viewer)

bbulla

I'd rather be golfing
Local time
Today, 14:30
Joined
Feb 11, 2005
Messages
101
Hi,

I'm using the following code in .NET to insert some data into a table. The connection is already open other commands are working.

mySQL = "INSERT INTO tblWINTER_DETAILS (RECORDNUM, ITEMNUM, DETAILS, ACTION) VALUES (" + recNum + ", " +
"1, " + "'This is a detail', " + "'Action this');";
myCommand.CommandText = mySQL;
myCommand.ExecuteNonQuery();

I am getting an 'Invalid Text' error, but if I go into debug mode, copy and paste the value of mySQL directly into the MS Access database and run the SQL Query, it inserts the record with no problems.

Any ideas?? The error I am getting is code # -2147217900
 

bbulla

I'd rather be golfing
Local time
Today, 14:30
Joined
Feb 11, 2005
Messages
101
So if I rename the fieldname 'ACTION' the SQL statement in .NET will work. Not sure why, but that seems to do that trick.
 

Users who are viewing this thread

Top Bottom