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 GadhiyaPosted Jul 1, 2014, 8:07 AM
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
prince rajPosted Jul 1, 2014, 9:18 AM
its my fault to use keyword as Column name.
Anupam SinghPosted Jul 1, 2014, 7:44 AM
You can try to insert DateTime.Today instead of DateTime.Now
Akhil MittalPosted Jul 1, 2014, 7:30 AM