Connecting to a MySQL database using ODBC
-
Hi
I am new to Qt and I have tried to connect MySQL database using QODBC but it does not work at all. Can you please help me step by step.I am using windows 8.1 64 bit
I have installed MySQL connector 5
and configured system DSN and my code is@
QSqlDatabase db = QSqlDatabase::addDatabase("QODBC");
db.setHostName("localost");
db.setDatabaseName("youtube");
db.setUserName("root");
db.setPassword("");if(db.open()){ qDebug() << "Opened!"; db.close(); } else { qDebug() << "Error = " << db.lastError().text(); }
@
Thank you
[edit: please add @ tags around your code, Eddy]