Quantcast
Channel: Forum SQL Server Database Engine
Viewing all articles
Browse latest Browse all 15889

C++ CLR SqlConnection error: "network-related or instance-specific error/"The network path was not found"

$
0
0

Hi, I am trying to get a connection to a SQL Database running on SQL Server Express 2012. When I connect using

System::Security::SecureString^ CStr = gcnew System::Security::SecureString;
	CStr->MakeReadOnly();
	SqlCredential ^cre = gcnew SqlCredential("hans\a",CStr);
	SqlConnection ^ conn = gcnew SqlConnection("Data Source=HANS\SQLEXPRESS;Initial Catalog=soccer;Integrated Security=False",cre);
      conn->Open();

the line "conn->Open();" thros following exception: "A network-related or instance-specific error occurred while establishing a connection to SQL Server". the provider is "Named Pipes Provider", the error code is "40".

It goes on to say that I should check that the instance name is correct, and that the server is configured to accept remote connections. the latter is true ( I have checked this), the former (the instance name) seems to be correct to me. If it is not correct, How do I change it so that this works? Does anyone have any additional info??

Add-in: There seems to be an additional exception of type System.ComponentModel.Win32Exception: "The network path was not found". Maybe, that's some additional info that can help :)

Thanks! :)

Cheers!

C


Viewing all articles
Browse latest Browse all 15889

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>