HELP, The connection string does not work

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 !!!!!!!!!!!!
 
K

Ken Cox [Microsoft MVP]

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top