QT通过query.exec(str)判断数据库是否断开连接
通过query.exec(str)执行sql语句判断数据库是否断开连接
QSqlDatabase db;
QSqlQuery query(db);
// bool b_ret= query.exec(sql_comm);
//执行SQL查询:bool b_ret= query.exec("SELECT * FROM mytable where name='abc'");
if(b_ret==true)
{
连接中。。。
}
else
{
已断开
}
欢迎讨论,相互学习。
cdtxw@foxmail.com

浙公网安备 33010602011771号