这是我的代码
public static SqlConnection con = new SqlConnection("Encrypt=false;TrustServerCertificate=True;workstation id=EgySoft.mssql.somee.com;packet size=4096;user id=Egysoft_SQLLogin_1;pwd=8g1jppy9vq;data source=EgySoft.mssql.somee.com;persist security info=False;initial catalog=EgySoft");
public MainPage()
{
InitializeComponent();
}
private void SignIn_Clicked(object sender, EventArgs e)
{
con.Open();
SqlDataReader R = new SqlCommand($"Select * From Accounts Where Username=N'{Username.Text}' And Password=N'{Password.Text}'", con).ExecuteReader();
if (R.Read())
{
DisplayAlert("Success", "You logged in Successfully", "Great");
}
R.Close();
}
如你所见,我正在使用 somee.com sql 连接数据库 当我将 Maui 应用程序作为 Windows 应用程序打开时它可以工作,但在 android 中不工作并给我这个错误
Microsoft.Data.SqlClient.SqlException: 'A connection was successfully established with the server, but then an error occurred during the pre-login handshake. (provider: TCP Provider, error: 35 - An internal exception was caught)'
我尝试了很多来自互联网的解决方案,但都没有用,请帮助。