public List <Purchases> getPurchases(int id) { string query = "select id, id_compra, cantidad, id_producto, p_u,total from tbadetcompras where id_compra='" + id.ToString() + "'"; MySqlDataReader data = runQuery(query); List <Purchases> result = new List <Purchases>(); if (data.HasRows) { while (data.Read()) { Purchases item = buildPurchases(data); result.Add(item); } } return(result); }