Hello
I am trying to connect to a sql server database, and I keep getting errors when trying to log in.
Here is my connection string:
Dim strConnection as String ="Initial Catalog=dsnName;UID=userID;Password=xxx;DATABASE=N orthwind;" />
The code I am using is straight from the Beginning ASP.NET Databases book and works fine on my localhost:
Code:
Dim objConnection As New SqlConnection(strConnection)
Dim strSQL As String = "SELECT FirstName, LastName, Country " & _
"FROM Employees;"
Dim objCommand As New SqlCommand(strSQL, objConnection)
objConnection.Open()
Response.Write("ServerVersion: " & objConnection.ServerVersion & _
vbCRLF & "Datasource: " & objConnection.DataSource & _
vbCRLF & "Database: " & objConnection.Database)
dgNameList.DataSource = objCommand.ExecuteReader()
dgNameList.DataBind()
objConnection.Close()
I keep getting a 'Login failed for user' exception, although it DID work initially for some reason (a couple of days) and then I began to receive an error. This user account was set up by the network admin. to allow access on an academic server. He set up the account and pw, and orginally we had an error of "Login failed for user 'NT AUTHORITY\LOCAL SERVICE,'" but he switched authentication mode to Mixed and now we have a general login failed error. (Using classic asp we are able to connect fine.) Any other suggestions would be very appreciated.
Thank You