norminator
March 13, 2008, 08:58 AM
Hey guys I am having some problems inserting a string into a database
Error: Syntax error in query string statement
Field type: Memo
Below is the code
string backupcall = "INSERT INTO tblPortLine (Line) VALUES ('" + RECORD + "')";
After debugging the program I realised that the string RECORD which receives data from a serial port contains an apostrophe ' which clashes with the syntax used in the INSERT statement.
For example:
RECORD may be equal to:
26/02/08 10:56AM 4128 0006 9228693- 00:02'16 00000.00 TR
If you look carefully there is an apostrophe between the numbers 2'16.
My question to you now guys is:
Is there a way for the INSERT statement to get around that?
Error: Syntax error in query string statement
Field type: Memo
Below is the code
string backupcall = "INSERT INTO tblPortLine (Line) VALUES ('" + RECORD + "')";
After debugging the program I realised that the string RECORD which receives data from a serial port contains an apostrophe ' which clashes with the syntax used in the INSERT statement.
For example:
RECORD may be equal to:
26/02/08 10:56AM 4128 0006 9228693- 00:02'16 00000.00 TR
If you look carefully there is an apostrophe between the numbers 2'16.
My question to you now guys is:
Is there a way for the INSERT statement to get around that?