Utku
24th October 2009, 20:57
Hello guys. My application works well on my PC. But if I try to use it on the PC which needs my application, it doesn't connect to SQL server. I tried ODBC (MySQL ODBC connector) and SQLite as database server. I don't know what causes to error; I've copied required DLLs, checked my connection code but found nothing.
Here is my connection function:
QSqlDatabase library::database()
{
QSqlDatabase db = QSqlDatabase::addDatabase("QODBC");
db.setDatabaseName("Library");
bool ok = db.open();
if (!ok) { QMessageBox::critical(this, "Error!", "Can't connect to database."); }
return db;
}
Thanks in advance for your replies.
Here is my connection function:
QSqlDatabase library::database()
{
QSqlDatabase db = QSqlDatabase::addDatabase("QODBC");
db.setDatabaseName("Library");
bool ok = db.open();
if (!ok) { QMessageBox::critical(this, "Error!", "Can't connect to database."); }
return db;
}
Thanks in advance for your replies.