|
.net
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Problem connecting to SQL Server 2000 using VS 2005 (Please help!)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... 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
Other interesting topics
hides inherited member ApplicationInstance
ObjectDataSource won't perform updates Access to the path is denied - trying to write a file CheckBoxList problem. Want to add some javascript to each checkbox CSS Question One application... multiple domains Error: Cannot use a leading .. to exit above the top directory. Can I have a global.asax just for an application? The type '_Default' conflicts with the imported type '_Default' 2005 Differences in a nutshell? |
|||||||||||||||||||||||