Link to home
Start Free TrialLog in
Avatar of kapiljoshi
kapiljoshi

asked on

Err connecting to SQL 2000 from VS 2005

I'm trying to connect to an SQL Server 2000 DB from VS 2005 through Server Explorer -> Add Connections. I'm getting the following error for that :

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)

though i've SQL Server 2000 running locally on my machine. & why is it connecting to SQL Server 2005, i want it to connect it to SQL Server 2000.

Any idea about this one.

Thanks in advance.
Avatar of Jorge Paulino
Jorge Paulino
Flag of Portugal image

Are you using the right connection string ? Show us your code.

jpaulino
Avatar of kapiljoshi
kapiljoshi

ASKER

My Web.config
has the following entry

<appSettings>
    <add key="ConString" value="Data Source=(localhost);Initial Catalog=NorthWind;User ID=sa;Password=kj"/>
  </appSettings>

My code behind .vb file has the following code
If Conn.State = ConnectionState.Open Then
            Conn.Close()
End If

Conn.ConnectionString = ConfigurationManager.AppSettings.Item("ConString").ToString
Conn.Open() --Err @ this line

Even without the code, if I try to create a connection from the Server Explorer using DataConnections -> Add Connection ... , I get the same error

Thanks.
Regards,
Kapil.
If you want to connect to SQL Server you have to change your connection string, not using localhost.

Have a look on this examples: http://www.connectionstrings.com/?carrier=sqlserver
ASKER CERTIFIED SOLUTION
Avatar of kapiljoshi
kapiljoshi

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
You can go to this link and ask to delete this question

https://www.experts-exchange.com/Community_Support/General/
thanks

regards,
KJ
Closed, 125 points refunded.
modus_operandi
Community Support Moderator