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."
4

1 回答 1

0

我知道这个问题已经有 2 年历史了,但是在其他应用程序中尝试这样做时,我找到了解决方案。所以这对任何想用谷歌搜索的人都可能有用。

数据类型varchar(max)ntext不兼容

在数据库中,我使用了数据类型ntext,但 Qt 使用varchar。所以解决方案在我问题的第一条评论中,我在 2 年前不明白。唯一要做的就是将数据库中的数据类型更改为varchar

于 2017-07-12T15:33:37.080 回答