Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Error: QSqlQuery::value: not positioned on a valid record

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Premise:

Win xp environment; Qt SDK version v1.1.3; library file version 4.7.4

Database driver type: QODBC

I have encountered the warning as described in the title twice.

All work out on their own.

The situations and solutions are as follows:

For the first time, use the QSqlRelationalTableModel model. Set the first column of the database to QSqlRelation

Model- > setRelation (0, QSqlRelation ("name_of_sql", "id", "name"); / / warning

Then the alarm appears when editing the database with QSqlRelationalTableModel.

Solution:

Do not set the first column of the database to QSqlRelation

On another occasion, when you set up the database, set the second column to primary key

Then an alarm appears when editing the database.

Solution:

Set the first column to primary key

I don't quite understand the principle of this kind of problem, but it is solved by accident. Share it with everyone.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report