QT QSqlQuery累问题
QSqlQueryquery;query.exec(QString("selectdoctoridfromdoctorwheredoctoronline=1"));whi...
QSqlQuery query;
query.exec(QString("select doctorid from doctor where doctoronline = 1"));
while(query.next()) //对在线医生数据操作
{
//更新在线医生下线时间,并新建一条数据
bool update = query.exec(QString("update doctortime set offline = '%1' where doctorid = '%2'").arg(nowtime).arg(query.value(0).toString()));
qDebug()<<"update"<<update;
query.exec(QString("insert into doctortime(doctorid,onlinetime,nowtime) values('%1','%2','%3')").arg(query.value(0).toString()).arg(nowtime).arg(nowdate));
}
while循环里面的语句是否会影响原query.next()的值 展开
query.exec(QString("select doctorid from doctor where doctoronline = 1"));
while(query.next()) //对在线医生数据操作
{
//更新在线医生下线时间,并新建一条数据
bool update = query.exec(QString("update doctortime set offline = '%1' where doctorid = '%2'").arg(nowtime).arg(query.value(0).toString()));
qDebug()<<"update"<<update;
query.exec(QString("insert into doctortime(doctorid,onlinetime,nowtime) values('%1','%2','%3')").arg(query.value(0).toString()).arg(nowtime).arg(nowdate));
}
while循环里面的语句是否会影响原query.next()的值 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询