Rretrieve list class from asmx to android

I want to read List object from MySQL database using web service "asmx"! But there is the problem of receiving an android !

[System.Xml.Serialization.XmlInclude(typeof(ItemClass))] public List SqlData() /// get list of notes { List Listitem = new List();
int UserID = 0;
string deviceid = "";
var phone = "";
string note = "";
try
{
using (MySqlConnection connection = new MySqlConnection(DBConnection.ConnectionString))
{

            string query = "SELECT * FROM clients_mo";

            using (MySqlCommand cmd = new MySqlCommand(query, connection))
            {
                                       connection.Open();

                using (MySqlDataReader reader = cmd.ExecuteReader())
                {
                    if (reader != null)
                    {
                        while (reader.Read())
                        {
                            ItemClass objitem = new ItemClass();
                            objitem.Item_name= reader["phone_num"].ToString();
                            objitem.Item_notes = reader["device_id"].ToString();

                            Listitem.Add(objitem);
                        }



                        reader.Close();

                        connection.Close();

                    }
                }
            }
        }
    }
    return Listitem;
}

}

xamarin \android

test.WebServiceDB rt = new test.WebServiceDB();
rt.SqlDataCompleted += this.Rt_SqlDataCompleted;
}

    private void Rt_SqlDataCompleted(object sender, test.SqlDataCompletedEventArgs e)
    {
      var callDialog = new AlertDialog.Builder(this);

        callDialog.SetTitle("nof");
         string []n;
          callDialog.SetMessage(e.Result.ToString());

        callDialog.SetNeutralButton("ok", delegate { });

        callDialog.Show();
    }
}

How he received from the Android correctly ?

Sign In or Register to comment.