hello, i cant insert in database.
if i remove date in insert query its work completely.
if i remove date in insert query its work completely.
string query = "insert into income_new(Cid, rs, rate, period, date) values ('" + cid + "','" + txt_Rs.Text.Trim() + "','" + txt_Rate.Text.Trim() + "','" + txt_Period.Text.Trim() + "','" + DateTime.Now + "')";
and datatype of date in access database is Date/Time. so...
----------
thanks in advance.

Vasu GadhiyaRank #7,540 · 239 reputationPosted Jul 1, 2014, 4:07 AM EDT
date is a reserved keyword.
You need to use square brackets around it to use in a query.
-------------------------------
string query = "insert into income_new(Cid, rs, rate, period, [date]) values ('" + cid + "','" + txt_Rs.Text.Trim() + "','" + txt_Rate.Text.Trim() + "','" + txt_Period.Text.Trim() + "','" + DateTime.Now + "')";
-------------------------------
If it is possible, I strongly suggest to change these names because you will have this problem everytime you hit this table.
Access 2007 reserved words and symbols
http://office.microsoft.com/en-us/access-help/access-2007-reserved-words-and-symbols-HA010030643.aspx
Akhil MittalRank #133 · 16.9K reputationPosted Jul 1, 2014, 3:30 AM EDT
Anupam SinghRank #643 · 3.7K reputationPosted Jul 1, 2014, 3:44 AM EDT
You can try to insert DateTime.Today instead of DateTime.Now
prince raj66 reputationPosted Jul 1, 2014, 5:18 AM EDT
its my fault to use keyword as Column name.