public List<ClubItem> GetClubItemList() { SQLiteDataReader reader; ClubItem item; List<ClubItem> clubItemList = new List<ClubItem>(); string query = "SELECT club_id, club_name FROM club ORDER BY club_name DESC;"; reader = DoTheReader(TrotTraxConn, query); while (reader.Read()) { item = new ClubItem(); item.ClubId = reader.GetString(0); item.ClubName = reader.GetString(1); clubItemList.Add(item); } reader.Close(); TrotTraxConn.Close(); return clubItemList; }
//Optional: sort (default is class_name) public List<ClubItem> GetClubItemList() { MySqlDataReader reader; ClubItem item; List<ClubItem> clubItemList = new List<ClubItem>(); reader = GetReader("trot_trax", "club", "club_id, club_name", String.Empty, "club_name"); while (reader.Read()) { item = new ClubItem(); item.clubID = reader.GetString(0); item.clubName = reader.GetString(1); clubItemList.Add(item); } reader.Close(); connection.Close(); return clubItemList; }