I have a Xamarin.Android application and I want the android emulator to get access to my database on localhost, I want to connect my application to my database by IP address. Here is the code I have so far:
var gridview1 = FindViewById<GridView>(Resource.Id.gvd);
var adapter = new ArrayAdapter<string>(this, Android.Resource.Layout.SimpleExpandableListItem1);
SqlConnection con = new SqlConnection("Data Source = localhost:1433;Initial Catalog = DB_B2B; Integrated Security = True");
SqlCommand cmd = new SqlCommand("select * from en_cours");
con.Open();
cmd.Connection = con;
SqlDataReader sqlreader = cmd.ExecuteReader();
while (sqlreader.Read())
{
adapter.Add((string)sqlreader[0]);
}
sqlreader.Close();
con.Close();
This is the error I receive when trying to connect:
System.Data.SqlClient.SqlException:
Snix_Connect (provider: SNI_PN9, error: 44 - SNI_ERROR_44)
Snix_Connect (provider: SNI_PN9, error: 44 - SNI_ERROR_44)