I am trying to open a SQL Compact Server file .sdf with Qt. I have the following code:
db.setDatabaseName("C:\\testresults.sdf");
bool Success = db.open();
sprintf(writeToMonitorBuffer, "dblastError = %s", (const char *)db.lastError().text().toLatin1());
writeToMonitor(writeToMonitorBuffer);
sprintf(writeToMonitorBuffer, "db.open(): Success/Fail = %s", Success ? "Pass" : "Fail");
writeToMonitor(writeToMonitorBuffer);
QSqlDatabase db = QSqlDatabase::addDatabase("QODBC");
db.setDatabaseName("C:\\testresults.sdf");
bool Success = db.open();
sprintf(writeToMonitorBuffer, "dblastError = %s", (const char *)db.lastError().text().toLatin1());
writeToMonitor(writeToMonitorBuffer);
sprintf(writeToMonitorBuffer, "db.open(): Success/Fail = %s", Success ? "Pass" : "Fail");
writeToMonitor(writeToMonitorBuffer);
To copy to clipboard, switch view to plain text mode
I am getting the error message:
dblastError = [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified QODBC3: Unable to connect
dblastError = [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified QODBC3: Unable to connect
To copy to clipboard, switch view to plain text mode
And I get:
db.open(): Success/Fail = Fail
db.open(): Success/Fail = Fail
To copy to clipboard, switch view to plain text mode
In the past I have connected to MS Access database by using
db.setDatabaseName("Driver={Microsoft Access Driver (*.mdb, *.accdb)};DSN='';DBQ=C:\\temp\\TestEng_TestDatabase.accdb");
db.setDatabaseName("Driver={Microsoft Access Driver (*.mdb, *.accdb)};DSN='';DBQ=C:\\temp\\TestEng_TestDatabase.accdb");
To copy to clipboard, switch view to plain text mode
Not sure what I should be putting for
"Driver={???}
Bookmarks