import-bot (20211) [Avatar] Offline
#1
[Originally posted by awiggans]

Can anyone tell me what is wrong with the statements below. when I run the
code with the first two parameters(storeID and status), everything works.
When I run the code as shown below, I get an exception, "Syntax error in
INSERT INTO statement".

I am using MS access, I have triple checked the column names and the field
sizes.

string strSQL = "INSERT INTO Customer "
+ "(storeID,status,first) "
+ "VALUES (?,?,?)";

comm.Parameters.Add("storeID", OleDbType.UnsignedTinyInt);
comm.Parameters.Add("status", OleDbType.Char, 3);
comm.Parameters.Add("first", OleDbType.Char, 15);

comm.Prepare();
import-bot (20211) [Avatar] Offline
#2
Re: Insert INTO syntax error
[Originally posted by arlen]

I am not sure, but "first" might be a reserved word. You might try putting it
in quotes:

string strSQL = "INSERT INTO Customer (storeID,status,"first") "
+ "VALUES (?,?,?)"


> Can anyone tell me what is wrong with the statements below. when I run the
> code with the first two parameters(storeID and status), everything works.
> When I run the code as shown below, I get an exception, "Syntax error in
> INSERT INTO statement".
>
> I am using MS access, I have triple checked the column names and the field
> sizes.
>
> string strSQL = "INSERT INTO Customer "
> + "(storeID,status,first) "
> + "VALUES (?,?,?)";
>
> comm.Parameters.Add("storeID", OleDbType.UnsignedTinyInt);
> comm.Parameters.Add("status", OleDbType.Char, 3);
> comm.Parameters.Add("first", OleDbType.Char, 15);
>
> comm.Prepare();
import-bot (20211) [Avatar] Offline
#3
Re: Insert INTO syntax error
[Originally posted by awiggans]

Uggh. You were right. "first" must be a reserved word. I changed my
database column to "firstname", and it worked. Thanks for your help.