简体   繁体   English

SQL Server的连接字符串

[英]Connection string for SQL Server

I have connection string, but it isn't working. 我有连接字符串,但是不起作用。 Why? 为什么?

Error: 错误:

A network-related or instance-specific error occurred while establishing a connection to SQL Server. 建立与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. 验证实例名称正确,并且已将SQL Server配置为允许远程连接。 (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified) (提供者:SQL网络接口,错误:26-指定服务器/实例时出错)

Connection string: 连接字符串:

<add name="CompanyEventConnectionString" 
     connectionString="database=db;server=PETLITSKY-R\SQLEXP;user id=sas; password=P@ssword1; MultipleActiveResultSets=True;" />

In the SQL Server Configuration Manager->SQL Server Network Configuration->Protocols, check that named pipes and tcp/ip are enabled. 在“ SQL Server配置管理器”->“ SQL Server网络配置”->“协议”中,检查已启用命名管道和tcp / ip。

If that doesn't work then it may be your firewall blocking it, try this link: http://msdn.microsoft.com/en-us/library/cc646023.aspx 如果这不起作用,则可能是您的防火墙阻止了它,请尝试以下链接: http : //msdn.microsoft.com/zh-cn/library/cc646023.aspx

This may be useful too: http://support.microsoft.com/kb/287932 这可能也很有用: http : //support.microsoft.com/kb/287932

<add name="ConString" connectionString="Data Source=.;InitialCatalog=ServerMaintenance;User Id=sa;Password=something;" />

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM