Qsqltablemodel incompatible data types

  • 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 = ui->lineEdit->text();
    sqlTableModel->submitAll(); //when this line is execeute i get an 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."

  • Issue is coming from Microsoft SQL where nnext is deprecated nvarchar. You can hit the google and fix this issue with Microsoft SQL. I saw many solutions available for this to fix. You can check the following link as well.


Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.