![](/img/trans.png)
[英]System.Data.SqlClient.SqlException when try to run script SQL from C# code
[英]System.Data.SqlClient.SqlException when I try to connect to SQL Server 2008R2 with a Windows Universal PlatformApp
嗨,當我嘗試從Windows Universal Platform App使用System.Data.SqlClient連接到Microsoft SQL Server 2008R2時,出現以下異常:
System.Data.SqlClient.SqlException:'已成功與服務器建立連接,但是在登錄過程中發生了錯誤。 (提供者:TCP提供程序,錯誤:0-操作成功完成)'
這是我的連接字符串,我正在使用SQL身份驗證:
string connectionString = "{Data Source=xxx.xxx.xxx.xxx; Initial Catalog=TheDatabase;Integrated Security=false;User ID=user;Password=Password}"
當我嘗試連接到2016 SQL Server時,一切正常,這是我的代碼:
using (SqlConnection connection= new SqlConnection(connectionString))
{
connection.Open();
}
在connection.Open()處引發了異常
注意事項:
該線程提出了同樣的問題: 鏈接到問題
SQL Server 2008R2的Service Pack 3可以幫助嗎?
是否有變通辦法或更好的方法來使2008R2與WUP一起使用?
安裝2008R2 Service Pack解決了該問題。 我嘗試使用2008R2 Express在本地PC上重現該問題。 我重現了該問題,並在對2008R2 Service Pack 2 Express進行了更新之后,一切正常進行。
我將在生產環境中安裝Service Pack 3,並在運行時對其進行更新
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.