22,209
社区成员
发帖
与我相关
我的任务
分享
QSqlDatabase db = QSqlDatabase::addDatabase("QODBC");
db.setDatabaseName("DRIVER={Microsoft Access Driver (*.mdb)};FIL={MS Access};DBQ=C:\\Users\\HJZ\\Documents\\QTPro\\Uver\\Database1.mdb");
qDebug()<<dsn;
if (!db.isValid())
{
QMessageBox::information(&w, "", "inValid", QMessageBox::Information);
}
bool ok = db.open();
if (ok)
{
QMessageBox::information(&w, "", "succes", QMessageBox::Information);
}
else
QMessageBox::information(&w, "", "filed", QMessageBox::Information);