Hi..
I have a trouble to connect to a mysql databse!!
I used a simple function to estblish connection in the main method :
Code:
bool createConnection(){ db.setDatabaseName("projet_cpp"); db.setPassword("passwrd"); db.setHostName("localhost"); if(!db.open()) { qApp->tr("Unable to establish a database connection.\n" return false; } qApp->tr("Goood It Works.\n" return true; } int main(int argc,char *argv[]){ if (!createConnection()) return 1; .. .. }
after execution I get always the messageBox telling that conexion was failled..
I read in Qt assistant that I should add the following include:
#include "C:\Qt\4.3.4\src\sql\drivers\mysql\qsql_mysql. cpp"
but it gives only errors !!
I tried :#include "C:\Qt\4.3.4\src\sql\drivers\mysql\qsql_mysql. h"
but it gives the error :mysql.h no such file or directory within qsql_mysql.h!!!
if someone could help !!
thanks