Click here to Skip to main content
15,896,912 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i m running a program using access as database but when i m storing date it shows me error as:-
"syntax error in insert statement"

the code m using is :-
C#
string instr = "insert into [MST_QUOTATION] (Quotation_No,Customer_ID,Customer_Name,Address,Zipcode,Email,Contact,Date)values(100001,3,'Tejas','ABCDSDF',382346,'vvvjh@hv',442122121,'" + abc + "')";

or
C#
string instr = "insert into [MST_QUOTATION] (Quotation_No,Customer_ID,Customer_Name,Address,Zipcode,Email,Contact,Date)values(100001,3,'Tejas','ABCDSDF',382346,'vvvjh@hv',442122121,'2013-02-10')";
Posted
Updated 12-Feb-13 19:51pm
v2
Comments
Gunjan Bhasin 13-Feb-13 2:04am    
can you post the error message?

1 solution

Try putting square brackets around the Date column:
C#
string instr = "insert into [MST_QUOTATION] (Quotation_No,Customer_ID,Customer_Name,Address,Zipcode,Email,Contact,[Date])values(100001,3,'Tejas','ABCDSDF',382346,'vvvjh@hv',442122121,'" + abc + "')";
 
Share this answer
 

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