public Trein GetTreinbyId(long id) { string sql = "Select * from Trein where id=@id"; List <KeyValuePair <string, string> > parameters = new List <KeyValuePair <string, string> > { new KeyValuePair <string, string>("id", id.ToString()) }; DataSet results = ExecuteSql(sql, parameters); Trein p = null; if (results != null && results.Tables[0].Rows.Count > 0) { p = DataSetParser.DataSetToTrein(results, 0); } return(p); }
public List <Trein> GetAllTreinen() { string sql = "Select * from Trein "; List <KeyValuePair <string, string> > parameters = new List <KeyValuePair <string, string> >(); DataSet results = ExecuteSql(sql, parameters); List <Trein> treinen = new List <Trein>(); if (results != null) { for (int x = 0; x < results.Tables[0].Rows.Count; x++) { Trein p = DataSetParser.DataSetToTrein(results, x); treinen.Add(p); } } return(treinen); }