Qt mysql查询结果处理

 

#include <QtSql/QSqlQuery>
#include <QtSql/QSqlRecord>


QSqlQuery query_sql = vcManageDatabaseObj->searchObjBySchoolNameAndNamePY(inputNameStr, inputIDCardStr, loginUserID);

if (query_sql.size()>0)
{
    while (query_sql.next())
    {
        QSqlRecord qResultRecord = query_sql.record();
        for (int fileIndex = 0; fileIndex<qResultRecord.count(); fileIndex++)
        {
            int id1=-1;
            QString indexFileName = qResultRecord.fieldName(fileIndex);
            if (indexFileName == "id")
            {
                id1 = query_sql.value(fileIndex).toString().toInt();
            }
        }
    }
}

 

Qt连接mysql,查询结果处理方法。

###############################

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-27
  • 2021-08-16
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-04-10
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案