C# WPF EF DB连接字符串:在连接字符串中使用附加的DB时出错
此连接字符串有效 在本地系统上,我使用了数据库连接字符串C# WPF EF DB连接字符串:在连接字符串中使用附加的DB时出错,c#,wpf,sql-server-2008,entity-framework,windows-installer,C#,Wpf,Sql Server 2008,Entity Framework,Windows Installer,此连接字符串有效 在本地系统上,我使用了数据库连接字符串 <connectionStrings> <add name="GaugeSelectorEntities" connectionString="metadata=res://*/Gage.csdl|res://*/Gage.ssdl|res://*/Gage.msl;provider=System.Data.SqlClient;provider connection string="Data S
<connectionStrings>
<add name="GaugeSelectorEntities" connectionString="metadata=res://*/Gage.csdl|res://*/Gage.ssdl|res://*/Gage.msl;provider=System.Data.SqlClient;provider connection string="Data Source=GEORGE1\SQL08R2;Initial Catalog=GaugeSelector;Integrated Security=True;MultipleActiveResultSets=True"" providerName="System.Data.EntityClient" />
</connectionStrings>
事实上,我将数据库的mdf文件从其位置复制到了可执行路径中的文件夹DB中。顺便说一句,我正在使用LINQ进行EF。但现在我开始得到错误
{"The underlying provider failed on Open."}
现在我读到一些东西,如果对象上下文未打开,可能会发生这种情况。所以我把
GSData.Connection.Open();
但现在它在这里中断了,并且出现了同样的错误。
我的方法本身是错误的(那么应该是什么方法)还是只需要对连接字符串进行一些小的更正?每个用户都在运行自己的数据库实例吗?每个用户都有自己的数据库实例
{"The underlying provider failed on Open."}
GSData.Connection.Open();