Hi,
I am new here. I am learning C# .net 4 by myself. I got a connection problem when I tried runing some simple ADO code.
I downloaded SQL2000.sample.database and install it . In Visual Stadio Veiw manu and Server Explorer/Database Explorer Add connection wizard, I choosed Microsoft SQL Server (SqlClient) for data source, I typed "computer_name\SQLEXPRESS" for sever name. I choose "using Windows authorize" . I choosed "Northwind" for database name. The test connection is successful.
When I running below simple connection code
Code:
string source = "server=./sqlexpress;" +
"Integrated security=SSPI;" +
"Initial catalog=NORTHWIND";
SqlConnection conn = new SqlConnection(source);
conn.Open();
conn.Close();
I got SqlEXception:
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).
I am not sure I missed somthing or did something. Hope someone here can help me.
I am using Windows XP, Visual stadio 2010 pro version and only have sqlexpress server.
Thanks.
Bob