2012-06-22 214 views
1

我已創建表單並連接到SQL Server數據庫。表格中輸入的數據進入數據庫。但是,當我將相同的表單上傳到上傳表單中時,卻出現錯誤。請幫我解決SQL Server未連接

Server Error in '/' Application. 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: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified) 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: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)

Source Error:

Line 23:
Line 24: SqlConnection con = new SqlConnection(@"Data Source=.\sqlexpress;Initial Catalog=Accomdation;Integrated Security=True");

Line 25: con.Open();

回答