Weird SQL Connection String problem?

G

Guest

I am connecting to my SQL database using following connection string

Dim strSQL = "Persist Security Info=False;Integrated
Security=False;database=myDA;server=myServerNane;User ID=;Password="
Dim conn As New SqlConnection(strSQL)

conn.Open()
conn.Close()

The above code works fine, even if User ID and password are blank? How is it
possible?
 
C

Chris Dunaway

I am connecting to my SQL database using following connection string

Dim strSQL = "Persist Security Info=False;Integrated
Security=False;database=myDA;server=myServerNane;User ID=;Password="
Dim conn As New SqlConnection(strSQL)

conn.Open()
conn.Close()

The above code works fine, even if User ID and password are blank? How is it
possible?

Perhaps it's defaulting to a trusted connection or your SQL Server is set
to allow Windows authentication?

Just a guess.

--
Chris

dunawayc[AT]sbcglobal_lunchmeat_[DOT]net

To send me an E-mail, remove the "[", "]", underscores ,lunchmeat, and
replace certain words in my E-Mail address.
 
N

Nick Malik

If you don't actually perform a SQL Command in between the Open and the
Close, you would never know.

ADO will not actually attempt to acquire a connection object until you need
one. From the code you posted below, you don't need one.

Put in a command object to do something trivial. Then your connection
string will be validated.

--- Nick
 
M

Morten Wennevik

Hi Job,

You use the integrated Sql Security to connect (no windows authentication)
and I assume the Sql Server has a guest account enabled (anonymous). You
may be able to connect, but the guest account quite often has no database
access rights.
 

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