HELP, The connection string does not work

  • Thread starter Thread starter lloyd
  • Start date Start date
L

lloyd

i am trying to connect to my Sqlserver on my machine.
i tried using the following connection strings

1)

mystring= "Initial Catalog=[SmartLan 2.0 ED];Data
Source=localhost;Integrated Security=SSPI;UID='sa';PWD="
myConn = New SqlConnection(mystring)
myCommand.Connection = myConn
myConn.Open()
myCommand.CommandText = "Select * from agegender"
myCommand.ExecuteXmlReader()

when i execute the connection it says login failed for
'L20935-P3\ASPNET',but i am sure the password is right, i have
verified the password works

i then tried the other option

2)
mystring= "database=[SmartLan 2.0 ED];data source=localhost;user
id=sa;password=;"
..
..
..
when i execute the connection it says login failed for
'L20935-P3\ASPNET' for user sa

i dont know whats going on???
can anyone please help me !!!!!!!!!!!!
 
Hi Lloyd,

It looks like you're mixing and matching portions of the connection string
in a way that doesn't work.

You're trying to use both integrated security and the userID/password
method.
 
Back
Top