I hav configued the Mysql successfully, now its showing QMYSQL in availabel drivers list.
I configured Mysql Server5.0 on my local machine and created database.
Using below code ,it connects to database but when I query it ,doesnt return any records,
so I tried checking my query with Query.lastquery() just before I execute it,and found that its returning blank.that means the query is not set properly ,what could be the error?
Qt Code:
QSqlQuery query; bool ok; db.setHostName("localhost"); db.setDatabaseName("ams"); db.setUserName("root"); db.setPassword("gauranga"); db.setPort(3306); if(!db.isOpen()) ok = db.open(); if(!ok) { out << "\nError Driver text: " << db.lastError().driverText() ; out << "\nError Database text :" << db.lastError().databaseText(); } else { out <<"DB open successfully"; ok = query.prepare("SELECT * FROM info"); out << "\nQuery is: " << query.lastQuery(); }To copy to clipboard, switch view to plain text mode
Bookmarks