问题描述
- 看看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:hlgdebugsyxt.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:hlgdebugsyxt.exe exited with code 0plugins拷的到处都是。都找不到。这么个破数据库直接让连上不就得了,
解决方案
http://www.devbean.net/2013/06/qt-study-road-2-database/
解决方案二:
参考:http://bbs.csdn.net/topics/370092004
解决方案三:
谢谢两位,解决了,重新编译了下odbc dll
时间: 2024-08-31 08:28:35