【发布时间】:2013-10-06 11:56:48
【问题描述】:
我有这张桌子:
Items
====
Barcode (text)
Des (text)
Price (double)
我在 d:\Items.csv 上制作了 csv 文件以便快速插入 (12345,computer,120.44).....
我尝试这样插入(C# WinForm 程序):
Cmd = Conn.CreateCommand();
SQL = @"INSERT INTO Items SELECT * FROM [Text;DATABASE=" + @"d:" + @"\].[Items.txt];";
Cmd.CommandText = SQL;
Cmd.ExecuteNonQuery();
但我得到了 2 个错误:
1. Data type mismatch in criteria expression.
2. The field 'Items.Barcode ' cannot contain a Null value because the Required property for this field is set to True. Enter a value in this field.
如何解决这个问题?
【问题讨论】:
-
你的
SQL在调试时是什么样子的? -
您知道您有 d:\Items.csv,并且在您的代码中您有 Items.txt?文件存在吗?
标签: c# winforms ms-access odbc