从C#插入QODBC

时间:2020-03-12 21:52:38

标签: c# quickbooks qodbc

我正在尝试通过QODBC将数据插入Quickbooks的“事务”表中,但是出现以下错误:

System.Data.Odbc.OdbcException:'错误[42S00] [QODBC]一个或多个字段的数据类型不匹配。运算符的无效操作数:<assignment>'

我使用VBDEMO遇到了同样的错误, 我尝试了几种方法,但遇到相同的错误。

我附上了我在C#中使用的代码:

string entity = "MARIA";
string Account = "DISPONIBLE:EFECTIVO Y EQUIVALENTES AL EFEC:1112  BANCOS,2020-03-12";
string amount ="400";
string Memo = "Pruebas Migracion";
DateTime date = Convert.ToDateTime("2020/03/12");


OdbcCommand comm = conn.CreateCommand();
//comm.CommandText = "INSERT INTO Transaction(EntityRefFullName,AccountRefFullName,TxnDate,Amount,Memo) VALUES('"+ entity + "','" + Account + "','" + fecha + "','" + amount + "','" + Memo +  "')";
comm.CommandText = "INSERT INTO Transaction(TxnDate,Amount) VALUES('" + date.ToShortDateString() + "'," + amount + ")";
MessageBox.Show(comm.ExecuteNonQuery().ToString());

0 个答案:

没有答案