Click here to Skip to main content
15,892,746 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Hi all. I am having some trouble with an insert statement I am using to insert strings into an access database and I keep receiving a "Syntax error in INSERT INTO statement."

Here is my code:

string insertString = "INSERT INTO Master_Alarm_List(Alarm_Date, System, Start, [End], Station, Easting, Northing)VALUES(@date, @system, @start, @end, @station, @coordse, @coordsn,)";
               
OleDbCommand com = new OleDbCommand(insertString, con);


Can anyone see a problem with this statement?

Any help is appreciated.

Thanks!
Posted
Updated 28-Sep-10 10:24am
v2
Comments
GianniOD 28-Sep-10 16:35pm    
My eyes have failed me haha..

Thanks guys!

You have a trailing comma you need to get rid of.
 
Share this answer
 
Comments
TheyCallMeMrJames 28-Sep-10 16:25pm    
;o)
GianniOD 28-Sep-10 16:34pm    
Reason for my vote of 5
Automatic vote of 5 for accepting answer.
TheyCallMeMrJames 29-Sep-10 15:11pm    
lol...and a 5 to you cause hey, great minds think alike ;o)
Remove the last comma after @coordsn.

Cheers.
 
Share this answer
 
Comments
GianniOD 28-Sep-10 16:34pm    
Reason for my vote of 5
Automatic vote of 5 for accepting answer.
AspDotNetDev 28-Sep-10 18:20pm    
Looks like you beat me by a matter of seconds. A 5 for you :-)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900