System.Data.SqlClient.SqlException: SQL Server does not exist????

G

Guest

I'm getting the following error when running my web app on my localhost web
server:

System.Data.SqlClient.SqlException: SQL Server does not exist or access denied

I drag and dropped an sqlconnection1 object onto my web from from the server
explorer. I'm getting the above error on the following line of code in my web
form:

da.Fill(ds, "Results")

Does anyone know what I need to do to correct the above error? What is
causing this error?
 
C

Cor Ligthert

GTDriver,
I drag and dropped an sqlconnection1 object onto my web from from the
server
explorer. I'm getting the above error on the following line of code in my
web
form:

da.Fill(ds, "Results")
Is this the only code you have or is there more?

Cor
 
W

W.G. Ryan eMVP

Make sure the account that you are connecting with has permissions to access
the DB. Since you're in a web scenario, I'm betting you specified Trusted
Connnection and the ASP.NET account doesn't have permission to the db.
 
G

Guest

Here is the code I have for a button:
Dim cmd As SqlCommand = SqlConnection1.CreateCommand
cmd.CommandType = CommandType.Text
cmd.CommandText = txtQuery.Text

'create a SqlDataAdapter to talk to the database
Dim da As SqlDataAdapter = New SqlDataAdapter
da.SelectCommand = cmd

'create a dataset to hold the results
Dim ds As DataSet = New DataSet

'fill the dataset
da.Fill(ds, "Results")

'bind it to the datagrid
dgResults.DataSource = ds
dgResults.DataMember = "Results"
dgResults.DataBind()

I'm using the Northwind DB in sql server. Also, here is the SqlConnection1
ConnectionString property:
workstation id=****;packet size=4096;integrated security=SSPI;initial
catalog=Northwind;persist security info=False
 
C

Cor Ligthert

GTDDriver,

I use this connection string for northwind with SQLClient

("Server=(Local); DataBase=Northwind;" & _
"Integrated Security=SSPI")

Maybe it helps,

Cor
 
S

Sambathraj

Hi,
Whenever you are windows authentication, ensure that anonymous access to the
virtual directory has been removed.
To do this go to the virtual directory in IIS, Properties -> Directory
Security -> edit . Uncheck anonymous access and use only integrated windows
authentication.

Regards,
Sambathraj
 
R

rbutch

i know i experienced a real "head scratcher" a week or so ago and the problem was XP Service pack II. i had sql server 2000 on the same pc before working fine. the drive had a major failure and our tech dept had to install a new drive.
they've just recently started including XP-SP2 on the standard installs.
of course i had no idea that there were issues out there.
the tech re-installed with XP-SP1 and all was fine.
i just still need to find some patches for this combination.
i dont know if this is your problem or not but it did cause me some real grief.
thanks
rik

**********************************************************************
Sent via Fuzzy Software @ http://www.fuzzysoftware.com/
Comprehensive, categorised, searchable collection of links to ASP & ASP.NET resources...
 

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