标签:
#include <QCoreApplication> #include <Qtsql> #include <QtDebug> int main(int argc, char *argv[]) { QCoreApplication a(argc, argv); QSqlDatabase db=QSqlDatabase::addDatabase("QODBC"); db.setDatabaseName("testodbc"); db.setUserName("sa"); db.setPassword("scada"); if(db.open()) { qDebug()<<"opened"; } else { qDebug()<<"ERROR="<<db.lastError().text(); } return a.exec(); }
标签:
原文地址:http://www.cnblogs.com/hnu-wt/p/4305973.html