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:

Qt Code:
  1. QSqlDatabase library::database()
  2. {
  3. QSqlDatabase db = QSqlDatabase::addDatabase("QODBC");
  4. db.setDatabaseName("Library");
  5. bool ok = db.open();
  6. if (!ok) { QMessageBox::critical(this, "Error!", "Can't connect to database."); }
  7. return db;
  8. }
To copy to clipboard, switch view to plain text mode 

Thanks in advance for your replies.