SQL Server not exist or denide access

G

Giuseppe Pezzella

Dear friends my problem is this:
I have installed MSDE and when try to connect to it by this code:
Try

Dim conn As New SqlConnection("server=VSDOTNET;uid=sa;database=master")

conn.Open()

If (conn.State = ConnectionState.Open) Then

MessageBox.Show("Connection opened successfully")

End If

conn.Close()



Catch ex As SqlException

MessageBox.Show(ex.Message)

End Try

.....an msgbox show this message:"SQL Server not Exist or Denide Access". Why
??
 
W

William Ryan

You don't have a password included in your connection
string....add in pwd='' if your SA password is blank, if
not, make sure you include it. BTW, and this is just my
two cents, if you have a SQL Server and a blank password,
you probably want to add a password unless you are 100%
positive that the machine can't be accessed by anyone you
don't want to access it. You may even want to kill SA
altogether or give it a 20+ character strong password and
don't use it. Instead use an account that you change
periodically that has the same permissions.

I think the PWD thing will work for you.

Let me know if this doesn't fix it.

Good Luck,

Bill

W.G. Ryan
(e-mail address removed)
www.knowdotnet.com
 

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