这是 的构造函数QSqlQuery
:
QSqlQuery::QSqlQuery ( QSqlDatabase db )
Constructs a QSqlQuery object using the database db. If db is invalid,
the application's default database will be used.
QSqlDatabase db
是否可以稍后将数据库连接绑定到QSqlQuery
,如下所示:
QSqlQuery query;
query.setDatabase(db);//QSqlQuery does not have a setDatabase method
代替:
QSqlQuery query(db);