0

I have a simple form with button and some line edits and listview. In listview users can select items and in line edits edit their parameters.

int row = listView->selectionModel()->currentIndex().row();
QString text = lineEdit->text();
sqlTableModel->setData(sqlTableModel->index(row,3),title,Qt::EditRole);
sqlTableModel->submitAll(); //when this line is execeute i get an error

error:

QODBCResult::exec: Unable to execute statement: "[Microsoft][SQL Native Client][SQL Server]The data types varchar(max) and ntext are incompatible in the equal to operator. [Microsoft][SQL Native Client][SQL Server]Statement(s) could not be prepared."
  • If you have the possibility to change the data table you should probably do that. Convert the data type of columns from NTEXT to NVARCHAR(MAX). – user2672165 Jan 05 '15 at 08:03
  • @user2672165 Datatype of the column in database is varchar, I have tried to change it to NTEXT and to NVARCHAR but it is not working. It always shows me the same error. – Martin Bodický Jan 05 '15 at 15:31
  • I have exactlly the same problem with PyQt. I thing this is because there are incompatible types in WHERE clause (Update/Insert...) Is this problem related with the ODBC/QODBC driver? – uetoyo Jan 27 '16 at 12:15

1 Answers1

0

I know that this question is 2 years old, but when trying to do this in other application, I found a solution. So this might be useful for anyone who will google it.

The data types varchar(max) and ntext are incompatible

In the database I have used data type ntext, but Qt uses varchar. So the solution is in the first comment in my question, which I didn't understand before 2 years. The only thing to do, is to change the data type in database to varchar.