trreysyx
trreysyx
2016-05-14 13:38

看看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条回答

为你推荐

换一换