Hi all.
I want to use QT and connect to mysql server.
I have a big problem and i really can not fix that.
Step :
I install Free QT SDK
I make a simple project.
in .pro file
QT += sql
Source file :
db.setHostName("127.0.0.1");
db.setDatabaseName("ytr");
db.setUserName("root");
db.setPassword("");
if (!db.open()) {
db.lastError().text());
QSqlDatabase db = QSqlDatabase::addDatabase("QMYSQL");
db.setHostName("127.0.0.1");
db.setDatabaseName("ytr");
db.setUserName("root");
db.setPassword("");
if (!db.open()) {
QMessageBox::critical(0, QObject::tr("Database Error"),
db.lastError().text());
To copy to clipboard, switch view to plain text mode
After i run my project :
It appears me a message " QMYSQL driver can not loaded"
I try again with QMYSQL3, QMYSQL4... It show the same.
What problem with me ?
Thanks.
Diego
Bookmarks