hi,
with following code i ca not read the message complete, but it say something about Error on connecting user "sa". Reason: no security SQL Server connection..
db.setHostName("localhost");
db.setDatabaseName("DRIVER={SQL Server};SERVER=localhost;DATABASE=inventar;UID=sa;PWD=raphaelf");
db.setUserName("sa");
db.setPassword("raphaelf");
if(!db.open()){
QMessageBox::information(this,
"",db.
lastError().
text());
return false;
}
return true;
QSqlDatabase db = QSqlDatabase::addDatabase("QODBC");
db.setHostName("localhost");
db.setDatabaseName("DRIVER={SQL Server};SERVER=localhost;DATABASE=inventar;UID=sa;PWD=raphaelf");
db.setUserName("sa");
db.setPassword("raphaelf");
if(!db.open()){
QMessageBox::information(this,"",db.lastError().text());
return false;
}
return true;
To copy to clipboard, switch view to plain text mode
If i try like following i get this error: Data Source Name not found and no default driver specified QODBC3 : Unable to connect
..
db.setDatabaseName("inventar");
..
..
db.setDatabaseName("inventar");
..
To copy to clipboard, switch view to plain text mode
Bookmarks