2012-06-22 4 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();

ответ

0

Можно ли проверить, установлены ли параметры сервера и клиента в «Диспетчере конфигурации SQL Server»? На стороне сервера и на стороне клиента оба должны иметь один и тот же «Протокол» (TCP/IP, Shared Memory, Named Pipe, VIA). Вы также можете указать, какой из них использовать в строке соединения.

http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlconnection.connectionstring.aspx

Смежные вопросы