public clsFilmCollection() { clsDataConnection DB = new clsDataConnection(); DB.Execute("sproc_tblFilm_SelectAll"); Int32 recordCount = DB.Count; Int32 index = 0; while (index < recordCount) { clsFilm aFilm = new clsFilm(); aFilm.FilmId = Convert.ToInt32(DB.DataTable.Rows[index]["FilmId"]); aFilm.Title = DB.DataTable.Rows[index]["Title"].ToString(); mAllFilms.Add(aFilm); index++; } }
public List <clsFilm> SearchForFilm(string searchText) { List <clsFilm> SearchResults = new List <clsFilm>(); clsFilm aFilm = new clsFilm(); clsDataConnection DB = new clsDataConnection(); DB.AddParameter("@Title", searchText); DB.Execute("sproc_tblFilm_FilterBySimilarTitle"); Int32 recordCount = DB.Count; Int32 index = 0; while (index < recordCount) { aFilm = new clsFilm(); aFilm.FilmId = Convert.ToInt32(DB.DataTable.Rows[index]["FilmId"]); aFilm.Title = DB.DataTable.Rows[index]["Title"].ToString(); SearchResults.Add(aFilm); index++; } return(SearchResults); }