看看QT浪费我多少时间

ODBC连接在家里电脑上试的好好的,换机器就成这样了

QSqlDatabase Sqlwindow::db = QSqlDatabase::addDatabase("QODBC");
void Sqlwindow::connectDatabase()
{

db.setHostName("127.0.0.1");
db.setUserName("smkt");
db.setPassword("smkt1999");
db.setDatabaseName("smkt");
bool bRet = db.open();
   if(!bRet)
   {
        QCoreApplication::addLibraryPath("./plugins");
       QMessageBox::critical(NULL,"操","陆毅的机器又抽风了"+db.lastError().text());
      // QMessageBox(,,)"error open database"<<;
       db.lastError();
       exit(0);
   }
   qDebug()<<"open database success";

Starting D:\hlg\debug\syxt.exe...
QSqlDatabase: QODBC driver not loaded
QSqlDatabase: available drivers: QSQLITE QMYSQL QMYSQL3 QODBC QODBC3 QPSQL QPSQL7
QSqlDatabase: an instance of QCoreApplication is required for loading driver plugins
D:\hlg\debug\syxt.exe exited with code 0

plugins拷的到处都是。都找不到。这么个破数据库直接让连上不就得了,

http://www.devbean.net/2013/06/qt-study-road-2-database/

参考:http://bbs.csdn.net/topics/370092004

谢谢两位,解决了,重新编译了下odbc dll