看看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拷的到处都是。都找不到。这么个破数据库直接让连上不就得了,

3个回答

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

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问