Click here to Skip to main content
16,012,166 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Database in ms access as follows;

Sch_Date -     Datetime<br />
Session      - Number<br />
Coruse       - Text<br />
Faculty_Code - Text


Table Name is Tb_SCh_TIme_Table..

insert query as follows;

C#
 string sql;
sql = "insert into Tb_SCh_TIme_Table(Sch_Date,Session,Course,Faculty_Code)" + " values ('1/24/2013', 4,'TFC','NR')";

when i run and save error shows syntax error insert into in sql statement.

the above query is checked.
Posted
v2
Comments
[no name] 24-Jan-13 2:12am    
I suppose the problem is with date datatype

1 solution

Try the Below Code,
C#
con = new Sqlconnection("Insert into Tb_SCh_TIme_Table values('"+DateTime.Now.ToShortDateString() + "','"+textbox1.text+"','"+textbox2.text+"')",con);
 
Share this answer
 
v2

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