
Originally Posted by
toufic.dbouk
Did you read my previous comment ?
And i guess you mean in which location or directory , as Lesiok said its not a file , its a database , i told you 2 ways to do that.
Either you specify the server name and database name your connecting to or you create a DSN
Please read my previous post it clearly explains how to do that almost step by step.
Hope this helps.
Yes, I mean in which location. I want to be able to install this application on any PC and to work there. I want to compile it in Ubuntu too and be able there to make the application work. This is why I would need to know the location so I could zip the database with my application and all it's dll's.
I've wrote the next code:
//connect to database
db.setHostName("localhost");
db.setUserName("username");
db.setPassword("password");
db.setDatabaseName("database");
if ( !db.open() )
QMessageBox::critical(0,
"Error", db.
lastError().
text());
else
QSqlDatabase db(QSqlDatabase::addDatabase("QMYSQL"));
//connect to database
db.setHostName("localhost");
db.setUserName("username");
db.setPassword("password");
db.setDatabaseName("database");
if ( !db.open() )
QMessageBox::critical(0, "Error", db.lastError().text());
else
QMessageBox::information(0, "OK", "Merge!!!");
To copy to clipboard, switch view to plain text mode
and I get the following error box:
"QSqlDatabase: QMYSQL driver not loaded
QSqlDatabase: available drivers: QSQLITE QODBC QODBC3 QPSQL QPSQL7"
I've tried to copy libmysql.dll to the folder where my .exe file is and to my qtcreator.exe folder and it's still not working
Bookmarks