database
-
Hi,
First thing to do is to add
QT += sql
To your pro file
-
This post is deleted! -
@SGaist Its already added. What should I do next?
-
What error did you got next ?
What OS and Qt version are you running ?
-
Check the Database examples in Qt 4.x. Lots of good examples there that haven't changed much in Qt5.x.
Basically if the Qt related library/drivers aren't installed (for database model you need) where they can be found in your Qt path (check all assumptions on where you have installed Qt) the qmake and linker will have issues and report errors.
-Vince
-
@SGaist I am using windows 8 and QT 5.4
The errors I have mentioned in the post -
@Vince-Golubic How do I know whether the required libraries or drivers are installed?
And If they are not what should I do next? -
Did you re-run qmake after adding
QT += sql
?As for the additional libraries, you should have the MySQL client libraries installed.
-
@SGaist the console screen appears with the following output
QSqlDatabase : QMySQL driver not loaded
QSqlDatabase : available drivers: QSLQITE QMYSQL QMYSQL3 QODBC QODBC3 QPSQL QPSQL7
"Driver not loaded Driver not loaded" -
Please, search the forum a bit, that problem has already been discussed many times.
You need to install the MySQL client libraries and add the path to them to your Run panel's PATH environment variable
-
@SGaist Can you just please tell me how to add path
-
Projects -> Run -> Run Environment -> edit the value of PATH