Qt Access 2007

QSqlDatabase db = QSqlDatabase::addDatabase("QODBC");

QString accessFile = QCoreApplication::applicationDirPath() + "/resource/Database.accdb";
QString dsn = QString("DRIVER={Microsoft Access Driver (*.mdb, *.accdb)};FIL={MS Access};DBQ=%1").arg(accessFile);

db.setDatabaseName(dsn);

 

值得注意的是数据库文件*.accdb路径必须为绝对路径

posted @ 2013-03-20 15:53  酷熊  阅读(435)  评论(0编辑  收藏  举报