bool Database::CreateConnection(const QString str /* = "db.mdb"*/){ db = QSqlDatabase::addDatabase("QODBC"); db.setDatabaseName("DRIVER={Microsoft Access Driver (*.mdb)};FIL={MS Access};" "DBQ="+str); if (!db.open()) { QMessageBox::information(0,"Error",db.lastError().text()); return false; } return true;}