I got a little problem with the QODBC database connection. I have to open and use a ACCESS databasefile (.accdb) within my Qt programm, but I can't get it run. I think there is a mistake in the database name but I am not that familiar with database handling so I need a little help with this. I started a simple mainwindow projekt and put all the database stuff in the main function. Here is the code:
Ok I got it by myself. I post the solution in case anyone else has the same problem.
I use windows 7, 32 bit. If you want to use a database from type .mdb or .accdb with ODBC you have to register the database as datasource before you can use it via C++ in any case. It is rather simple to to do:
You go into start->system
type ODBC into the search field
the result is datasource(ODBC)-> click it
Under "User-DSN" you can add a new source
you have to choose a database (which is the one you want to use) and you can give it a sourcename for example "YOURSOURCE"
After you have done that you can call the database like that: