I connect it from my program.

I solve it. It must be

Qt Code:
  1. static bool createConnection(QString driver= "QODBC",
  2. QString connectionstr="DRIVER={SQL Server Native Client 10.0};"
  3. "Server=IP\\Instance;Trusted_Connection=yes;"
  4. "Database=Databasename;Uid="";Pwd="";"
  5. )
  6. {
  7. QSqlDatabase db = QSqlDatabase::addDatabase(driver);
  8. db.setDatabaseName(connectionstr);
  9. if (!db.open()) {
  10. QSqlError err = db.lastError ();
  11. QMessageBox::information(0, QObject::tr("Cannot open database"), err.text());
  12. return false;
  13. }
  14. return true;
  15.  
  16. }
To copy to clipboard, switch view to plain text mode 

And you have to install the native sql client.
Yes I use Qt4.5.0 ans compile it with the ODBC flag etc..

thanx