Problem connecting to SQL Server 2000 using VS 2005 (Please help!)

D

davidman73

Hello,

I have VS 2005 with SQL Server Express in the same machine, but need to
connect to a remote SQL Server 2000. I'm getting this error:

An error has occurred while establishing a connection to the server.
When connecting to SQL Server 2005, this failure may be caused by the
fact that under the default settings SQL Server does not allow remote
connections. (provider: Named Pipes Provider, error: 40 - Could not
open a connection to SQL Server)

I thought it was my code, so I put a GridView control in a blank web
page, started the wizard for a new database connection and finished
setting it up. If I click "Test Query" in the sqldatasource
configuration, it works and returns the rows just as expected. However,
if I run the app, I get the above error again.

I can also access the database with no problem at all using Server
Explorer.

I've been on this for a week now and I'm totally out of resources.

Please, help...
 
T

tdavisjr

By default, asp.net 2.0 connects to SQL Express 2005 so it stores this
connectionstring in the global web.config file in the
<connectionStrings> element. So, that means that your local web.config
file also has this SQL Express 2005 connectionString even though you
can see it since its inherited. If you want to connect to another
database server you must remove this default connectionString and add
it with your own connectionString. So, in your web.coniig do this:

<connectionStrings>
<clear /> <!-- this removes the inherited connectionstring -->
<add connectionString="[YOUR STRING HERE]" />
</connectionStrings>

I hope this solves your issues as you have been stuck for a week
 

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

Members online

Forum statistics

Threads
473,968
Messages
2,570,154
Members
46,702
Latest member
LukasConde

Latest Threads

Top