Johnny Rage Asked:2020-05-05 23:17:06 +0000 UTC2020-05-05 23:17:06 +0000 UTC 2020-05-05 23:17:06 +0000 UTC Qt:如何检查 query.value 是否为空 772 有一个类 QSqlQuery 查询的对象。查询获取某些查询的结果。如何检查 query.value 中存储的内容是否为 NULL? c++ 1 个回答 Voted Best Answer maestro 2020-05-06T00:14:14Z2020-05-06T00:14:14Z value类方法QSqlQuery返回一个类型的值QVariant。因此,null您需要使用QVariant. QVariant::isNull。使用示例: QSqlQuery query("SELECT country FROM artist"); while (query.next()) { if (query.value(0).isNull) qDebug() << "Null"; }
value类方法QSqlQuery返回一个类型的值QVariant。因此,null您需要使用QVariant. QVariant::isNull。使用示例: