Group: General Forum Members
Last Login: Tuesday, February 19, 2013 6:45 AM
|Sean Lange (1/17/2013) Patrick Hill-489170 (1/17/2013) Sean Lange (1/16/2013)
Patrick Hill-489170 (1/16/2013)
I know this is an old thread but figured I would post here instead of creating a new one. I too am having this issue. The odd thing is I get the error when I try to connect to the SQL Server using .NET code( VB.NET or C#). However, I tried using VB6 and it connects to the DB just fine and pulls the data(using the EXACT same connection string).
Remote connections is enabled, TCP/IP and naming pipes are enabled, I added both the TCP port 1433 and UDP port 1434 enabled in windows firewall and remote connections is enabled, I'm able to ping the IP of the server as well. I just find it really really odd that I can connect via a VB6 app but not a .NET app. Does anyone have any other ideas what I can try?
Using the EXACT same string in VB6 and .NET is probably the issue. It is very likely you don't want the same string because it is likely you are not making the same type of connection. Check out http://www.connectionstrings.com/
I checked connectionstrings.com this is the connection string I'm using:
So you said you can't connect. What is the actual message?
"A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)"
I can connect with VB 6, I can connect when I open up management studio and connect to the server. I can even create a .udl file and connect that way. I just can't get it to connect using .net
VB 6 code that connects:
cn.Provider = "sqloledb"
provStr = "Server=SSQLDBAT014001\RLSOLUTIONS;Database=FireSafety_Test;User Id=fs_admin;Password=******"
VB.Net Code that gives me that error:
Public Class Form1
Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
Dim cn As New SqlConnection
cn.ConnectionString = "Server=SSQLDBAT014001\RLSOLUTIONS;Database=FireSafety_Test;User Id=fs_admin;Password=******"