Thursday, March 22, 2012

connecting to SQL 2000 Server gives SQL 2005 error message

Hi,

Here is the syntax of the connection string within the web.config file:

<connectionStrings>
<clear />

<addname="MyConnectionString"connectionString="Data Source=000.000.000;Initial Catalog=Database Name;Persist Security Info=True;User ID=XXXXXX;Password=XXXXXX;"providerName="System.Data.SqlClient" />

</connectionStrings>

The test page has a GridView in it which uses the connectionstring fron the web.config file.

Error Message:

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)

Not sure why .NET thinks it's a SQL 2005 server

I can connect to the database via VS 2005, and through Enterprise Manager... just from the ASP.NET page.

Any ideas?

Thanks,
Roland

By default SQ2005 does not have remote connections enable, you need to go to Surface Configuration and the first tap change from pipe to remote connections. That shall fix the problem.

|||

Thanks Al, but the problem is that the server is SQL 2000 and NOT SQL 2005.

So, I'm not sure why .NET thinks, or is getting the information to say that the SQL server is SQL 2005.

So to reiterate the question:

Why do I get a SQL 2005 error while connecting to a SQL 2000 database?

Thanks again,

Roland

|||

Then must be a firewall between or again you can change SQL 2000 to use only pipes, check that and let me know

|||

Why you got a message about MS SQL Server 2005 while the version you have is MS SQL Server 2000?

This is beacuse you are using MS Viusal Studio.NET 2005 which install a SQL Express (lite SQL Server - similar to MSDE) on your machine and by default it will coneect to it.

This SQL Express uses a SQL Server 2005 engine, and that is why you saw "When connecting to SQL Server 2005, ...." message.

Ok, what to do?

Change the default connection string from your IIS.

Open your IIS, then click on your "Virtual Directory" (e.g. your ASP.NET Website) then go to its configuration and change the Server name part in the ConnectionString.

Hope this will help you as it helped me eairler.

Regards,

sqlsql

No comments:

Post a Comment