How can i use microsoft access database in Qt?
-
wrote on 26 Dec 2011, 18:27 last edited by
I was trying the following but i get (success = false.)
@ QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE");
db.setDatabaseName("Driver={Microsoft Access Driver (*.mdb, *.accdb)};DSN='';DBQ=C:/Users/pratik041/MyDocuments/pratik.accdb");
bool Success = db.open();
qDebug()<<Success;
@ what may be wrong in this? -
wrote on 26 Dec 2011, 18:32 last edited by
The fact that you're trying to use the Sqlite driver with an ODBC handle?
-
wrote on 26 Dec 2011, 18:48 last edited by
[quote author="peppe" date="1324924360"]The fact that you're trying to use the Sqlite driver with an ODBC handle? (hint, ihnt)[/quote]
but if i am using QODBC driver it is showing the driver is not loaded. -
wrote on 26 Dec 2011, 18:49 last edited by
@QSqlDatabase::isDriverAvailable("QODBC")@
will help you to make sure if ODBC driver is 'really' there.
-
wrote on 26 Dec 2011, 18:55 last edited by
I have checked. It is not available. So what i have to do now?
-
wrote on 26 Dec 2011, 19:03 last edited by
Build the ODBC plugin.
EDIT : you can start here : http://developer.qt.nokia.com/doc/qt-4.8/sql-driver.html#how-to-build-the-odbc-plugin-on-windows
-
wrote on 27 Dec 2011, 04:32 last edited by
where I have to write that in command prompt in the project or any other place?
-
wrote on 27 Dec 2011, 06:44 last edited by
startmenu -> All Programs -> Qt SDK -> Desktop -> cmd
7/8