连接字符串无效

时间:2015-07-31 08:53:02

标签: c# entity-framework

我尝试使用C#连接到SQL Server 2012数据库,服务器和程序都在同一台计算机上。当我尝试连接时,我得到一个例外:

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: 25 - Connection string is not valid)

有一个内部异常只是说{"The parameter is incorrect"}

我尝试使用此

进行连接
<add name="KBLEntities" connectionString="metadata=res://*/Models.KBL.csdl|res://*/Models.KBL.ssdl|res://*/Models.KBL.msl;provider=System.Data.SqlClient;provider connection string='data source=\sql8dvlp1\v01;initial catalog=KBL;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework'" providerName="System.Data.EntityClient" />

知道哪个参数不正确?

1 个答案:

答案 0 :(得分:0)

您是否也拥有与数据库的窗口相同的凭据? 您是否尝试使用集成安全性= false 并明确提供用户名和密码?

你能以这种方式连接吗?

另外,尝试提供数据源作为数据源=&#34;(本地)&#34; https://msdn.microsoft.com/en-us/library/ms156450.aspx