I am attempting to write a C# app that will attach to the 2008 SQL Server I have installed on my PC, but I am missing something, I think with the SQL Configuration.
I am able to connect to the SQL Server in MS-SMS, using both authentication modes.
The SQL Server is named HP_Deskyop\LPR_Home & is running on port 51650.
I have verified that TCP/IP & Named Pipes are enabled for this server.
I am running Norton 360, but I have disabled Smart Firewall.
I am receiving the error below when the Open() line is executed.
conn = new SqlConnection(Properties.Settings.Default.ConnString);
var cmd = new SqlCommand(strSQL, conn);
cmd.Connection.Open();
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: Named
Pipes Provider, error: 40 – Could not open a connection to SQL Server)
The connection string is
Data Source=LPR_HOME;Initial Catalog=Northwind;User
ID=sa;Password=XXXXXXX;
I have attempted numerous variations of the connection string, with no luck
HELP!!!!!
Change your Connection String to:
This did the trick.