• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 198
  • Last Modified:

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.
0
kapiljoshi
Asked:
kapiljoshi
  • 3
  • 3
1 Solution
 
jpaulinoCommented:
Are you using the right connection string ? Show us your code.

jpaulino
0
 
kapiljoshiAuthor Commented:
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.
0
 
jpaulinoCommented:
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
0
Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

 
kapiljoshiAuthor Commented:
I got the problem . the problem was not with the format of Connection string.

I was trying to connect with Machinename.
I was not specifying the Instance name of SQL Server i.e. Data Source=Machinename\SQL Server Instance Name

Thanks for the link though. Can i close this thread as self answered.

0
 
jpaulinoCommented:
You can go to this link and ask to delete this question

http://www.experts-exchange.com/Community_Support/General/
0
 
kapiljoshiAuthor Commented:
thanks

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

Featured Post

Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now