Hi,
I using VS2013 and Sqlserver 2012 express edition for the testing. What i did was i connected the database with frontend using server explorer and copied the connection string. when try to test the connection through the code it throws an error.
Here is my sample code:
string connstring = "Data Source=170.30.149.34;Initial Catalog=Sample;User ID=sa;Password=test";
using (SqlConnection conn = new SqlConnection(connstring))
{
conn.Open();
Response.Write("Connected");
}
Error:
An unhandled exception of type 'System.Data.SqlClient.SqlException' occurred in System.Data.dll
Additional information: 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)
Any suggestion please