1
Answer

My DataBase Connection Not connected?pls help me?

nanni nanni

nanni nanni

10y
897
1

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)

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Data.SqlClient.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)

Source Error:

Line 17:     { Line 18:         SqlConnection con = new SqlConnection("data source=SNR-PC;database=Student;User id=nanni1;Password=nanni1"); Line 19:         con.Open(); Line 20:         SqlDataAdapter adp = new SqlDataAdapter("select * from Customers", con); Line 21:         DataTable dt = new DataTable();

Answers (1)