2

I am trying to insert data into the "Transaction" table of Quickbooks through QODBC but I receive the following error:

System.Data.Odbc.OdbcException: 'ERROR [42S00] [QODBC] Data type mismatch for one or more field. Invalid operand for operator: <assignment>'

I get this same error using VBDEMO, I have tried several ways but I get the same error.

I attach the code that I use in 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());
Javier
  • 121
  • 3
  • 1
    did you ever come to a conclusion? – Franco Pettigrosso Nov 10 '21 at 19:42
  • 1
    Yes, they had to be the same type of data. In the same way I found other software that allowed me to interact with the Quickbooks DB. – Javier Nov 10 '21 at 22:29
  • I need to read and write data from QB as one component of a product... essentially what I was going to do was just use the SDK and create a custom QBD application in C#. Would you say QODBC is a good alternative? The docs are kind of confusing me tbh. There's so much conflicting information out there I'm becoming increasingly overwhelmed lol – anondev Mar 07 '23 at 16:25

0 Answers0