将记录插入MS Access时出错 [英] Error when inserting a record into MS Access
本文介绍了将记录插入MS Access时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的C#程序中有val MyDate
,其中包含 today-date 或 null .
I have val MyDate
in my C# program that contain today-date or null.
我在Access 2007中有日期字段-TdateOpen
I have date field in my access 2007 - TdateOpen
我尝试这样插入数据库:
I try to insert to the database like this:
SQL = "insert into MyCount(TdateOpen) values ('" + MyDate +"')";
我得到这个错误:
Data type mismatch in criteria expression
可能是什么问题?
推荐答案
在您的SQL语句中,Coz是以String的形式输入日期.而不是字符串,它应该是日期/日期格式. 尝试用#包围.
Coz in your SQL statement you are entering date as String . Instead of String it should be a date/date format. Try to surround by # .
这篇关于将记录插入MS Access时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文