I have a local MSSQL database with several users. I use server authentication in Management Studio successfully, but when I try to connect the database in QT it uses local windows username instead of the one I provided.
Code:
db.setDatabaseName("DRIVER={SQL Server};SERVER={8SQLQT};DATABASE=GradingSystem;Trusted_Connection=yes;");
db.setUserName("ivanov");
db.setPassword("1");
db.open();
qDebug() << db.userName() << db.lastError();
Debug output:
"ivanov" QSqlError("18456", "QODBC3: Unable to connect", "[Microsoft][ODBC SQL Server Driver][SQL Server]Login failed for user '8sqlqt\asdfgh'.")
asdfgh is a name of local windows user.