Meggy Peter

Meggy Peter

  • 1.6k
  • 32
  • 2.7k

Sql Server connection error

Jan 13 2023 6:07 PM

I have connection string 

public static string connectionString = @"Data Source=test123\SQLEXPRESS;Initial Catalog=TestDB;Integrated Security=true;Persist Security Info=true";

In my .xaml.cs file

 private async void LoadData()
        {
            
            using (SqlConnection conn = new SqlConnection(LibCommon.connectionString))
            {
                try
                {
                    conn.Open(); // error : System.Net.Sockets.SocketException: 'Could not resolve host 'name of the my host''
                    await DisplayAlert("OK", "Ok I am connected", "OK");
                }
                catch (Exception ex)
                {
                    await DisplayAlert("Error", ex.ToString(), "OK");
                }
            }

}

Please, help me to solve this error 


Answers (1)