A recent project to use Access, accustomed to SQL Server, a sudden return to access is a bit of a habit. When you use Access to insert date data, the general report data type mismatch in criteria expression error, although I used a parameterized way to pass the value, but the problem is not resolved.
After testing, the following two methods can solve this problem.
Method One:
If you use a parameterized method, you can use DateTime.Now.ToString () to convert the date type to a string type. It seems that access is still quite silly.
Method Two:
When you use the normal method of spelling SQL, replace it with #. Because Access treats # as a date identifier. For example
String sql = "INSERT into table ([TIME]) VALUES (#2009 -01-01#)".
Finally, if you have a keyword in the column in the INSERT statement, Access reports that the insert failed, and the best solution is to enclose the column name in [].
If you want to reprint, please specify this article original from csdn tjvictor column: Http://blog.csdn.net/tjvictor