The VB.Net code should be as follows:-
MSConn = New SqlConnection() If sAUTHMODE = "WIN" Then MSConn.ConnectionString = "Data Source=" & sSERVER & ";Initial Catalog=" & sDATABASENAME & ";User ID=" & sUSERNAME & ";Password=" & sPASSWORD & ";Integrated Security=True" ElseIf sAUTHMODE = "SQL" Then MSConn.ConnectionString = "Data Source=" & sSERVER & ";Initial Catalog=" & sDATABASENAME & ";User ID=" & sUSERNAME & ";Password=" & sPASSWORD & ";Integrated Security=False" End If
Otherwise, one of these error messages will appear:-
- Login failed. The login is from an untrusted domain and cannot be used with Integrated authentication.
- Login failed. The login is from an untrusted domain and cannot be used with Windows authentication.