Click to See Complete Forum and Search --> : sqlConnection - Login failed for user 'sa'


bslezak
April 14th, 2003, 08:21 PM
(Sorry for cross-post, posted in the wrong forum the first time.)

I have an interesting problem beyond the normal mixed mode security for SQL 2000. I'm a newbie to ASP.NET, and trying to get the Web App walkthrough example to work. My problem is that Windows Authentication works fine, but using a SQL user/pass does not. (Again, I _am_running SQL Server in mixed mode.)

I receive in the stack trace:

[SqlException: Login failed for user 'sa'.]
System.Data.SqlClient.SqlConnection.Open()

No problems at all when sqlConnection uses NT integrated security, but the above error is returned when I try sql user auth. I've added appropriate accounts to SQL server, and assigned them appropriate read/write permissions to the DB I'm working with. I've also tried creating a SQL account other than sa.

If this is something simple, it doesn't seem to be one of the common newb problems.

Any suggestions appreciated.

:mad:

Nagul
April 15th, 2003, 10:49 AM
Hey,
Don't know exactly what is causing a problem. But here is some part of code which connects to the database.

Dim objConn As SqlConnection
Dim objAdapter As SqlDataAdapter
Dim objDs As DataSet

objConn = New SqlConnection()

objConn.ConnectionString = "Server=SQLDEV;DATABASE=Accommodations;UID=sa;PWD=;"
objConn.Open()

objAdapter = New SqlDataAdapter("select accesslevelname from accesslevels", objConn)
objDs = New DataSet()
objAdapter.Fill(objDs)

Hope this helps you.

bslezak
April 15th, 2003, 08:02 PM
That did help a bit. I realized that the pwd tag was not being included in the connection string.

Anyone have ideas why when you use the wizard to create an sqlConnection object, that it ignores the fact there should be a password included? I even used the "Allow saving password" checkbox. ??

What did I do wrong, or why does it deliberatly break itself?

Thanks!