2015-01-05 2 views
0

단추가있는 간단한 양식과 일부 줄 편집 및 목록보기가 있습니다. listview에서 사용자는 항목을 선택하고 행 편집에서 매개 변수를 편집 할 수 있습니다.qsqltablemodel 호환되지 않는 데이터 형식

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 

오류 :

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." 
+0

데이터 테이블을 변경할 가능성이 있다면 그렇게해야합니다. 열의 데이터 형식을 NTEXT에서 NVARCHAR (MAX)로 변환하십시오. – user2672165

+0

@ user2672165 데이터베이스에있는 열의 데이터 유형이 varchar이고 NTEXT 및 NVARCHAR로 변경하려고했지만 작동하지 않습니다. 항상 동일한 오류가 표시됩니다. –

+0

다른 도움말이 없습니까 ?? –

답변

0

나는이 질문은 2 세임을 알고 있지만, 다른 응용 프로그램에서이 작업을 수행 할 때, 나는 해결책을 발견했다. 그래서 이것은 누군가에게 도움이 될 것입니다. 내가 NTEXT 데이터 형식 사용한 데이터베이스에서

The data types varchar(max) and ntext are incompatible

하지만, Qt는 VARCHAR를 사용합니다. 그래서 해결책은 2 년 전에 이해할 수 없었던 제 질문에 대한 첫 번째 의견에 있습니다. 데이터베이스에서 데이터 형식을 varchar으로 변경하는 것입니다.

관련 문제