Forum Xamarin.Android

Announcement:

The Xamarin Forums have officially moved to the new Microsoft Q&A experience. Microsoft Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

To create new threads and ask questions head over to Microsoft Q&A for .NET and get involved today.

mysql server connection problem

i am trying to connect my local sql server, but timeout occurs. any idea?

    public static DataSet Execute()
    {
        DataSet ds = new DataSet();

        SqlConnectionStringBuilder dbConString = new SqlConnectionStringBuilder();
        dbConString.UserID = "root";
        dbConString.Password = "123456";
        dbConString.DataSource = "10.0.2.2";


        using (SqlConnection con = new SqlConnection(dbConString.ConnectionString))
        {

            con.Open();
            SqlCommand cmd = new SqlCommand("SELECT * FROM table1", con);

            var adapter = new SqlDataAdapter(cmd);
            adapter.Fill(ds);

        }
        return ds;
    }

Answers

  • zgrYigitzgrYigit USMember

    any idea?

  • vsg24vsg24 TRMember ✭✭

    Maybe the IP is wrong. your local PC IP will be different when using emulator or connected device.

  • zgrYigitzgrYigit USMember

    pc's local host is "10.0.2.2" for emulator :/

Sign In or Register to comment.