Qt mysql QSqlQuery QSqlRecord
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,查询结果处理方法。
###############################
QQ 3087438119