Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/entity-framework/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 实体框架4.1与外部数据库的连接失败_C#_Entity Framework_Connection String - Fatal编程技术网

C# 实体框架4.1与外部数据库的连接失败

C# 实体框架4.1与外部数据库的连接失败,c#,entity-framework,connection-string,C#,Entity Framework,Connection String,我想连接到外部数据库。 我在添加连接字符串时检查了连接,没有问题。 然而,当我运行该程序时,它显示“我的帐户登录失败” 有人知道发生了什么吗 谢谢 编辑,连接字符串: connectionString="Data Source=server_of_th_db;Initial Catalog=the_DB;Integrated Security=SSPI;" 您可能不想使用integratedsecurity=SSPI表示当前Windows帐户凭据用于身份验证。 您可能必须指定用户I

我想连接到外部数据库。 我在添加连接字符串时检查了连接,没有问题。 然而,当我运行该程序时,它显示“我的帐户登录失败”

有人知道发生了什么吗

谢谢

编辑,连接字符串:

      connectionString="Data Source=server_of_th_db;Initial Catalog=the_DB;Integrated Security=SSPI;"

您可能不想使用
integratedsecurity=SSPI表示当前Windows帐户凭据用于身份验证。
您可能必须指定
用户Id
密码才能连接到远程服务器。比如:

connectionString="Data Source=server_of_th_db;Initial Catalog=the_DB;Uid=MY_USER_ID;Pwd=MY_PASSWORD;"  
您必须从该服务器的dba获取这些凭据

更新:
另一个可能的问题是您使用了错误的.config文件。如果您的解决方案中有多个项目,请确保启动项目的
connectionstrings
部分设置正确。

您是否检查了提供的凭据,并粘贴了异常信息。我们需要更多详细信息:您是否可以使用DBMS(即Sql Server Management Studio)连接到数据库?@Shai yes,我可以使用DQL Server Management Studioo连接到该数据库。您可以向我们显示您的连接字符串吗?@Shai连接字符串张贴在上面。我尝试了上面的代码,但错误仍然存在。我想使用SQL身份验证,但返回的错误表明我的windows帐户登录失败