QSqlQuery query; query.exec(QString("select count(*) from sqlite_master where type='table' and name='%1'").arg(TableName)); if(query.next()) { if(query.value(0).toInt()==0) { // 表不存在 }else{ //表存在 } }
QT SQLITE 判断表是否存在
最新推荐文章于 2024-01-05 11:39:38 发布
QSqlQuery query; query.exec(QString("select count(*) from sqlite_master where type='table' and name='%1'").arg(TableName)); if(query.next()) { if(query.value(0).toInt()==0) { // 表不存在 }else{ //表存在 } }