public static IList <Comments> FindAll(string sql = "") { sql = string.IsNullOrEmpty(sql) ? "select * from Comments" : sql; IList <Comments> list = new List <Comments>(); using (DataTable dt = OleDbHelper.GetDataSet(sql)) { foreach (DataRow r in dt.Rows) { list.Add(Read(r)); } } return(list); }
public static IList <Category> FindByParent(int parentId) { string sql = string.Format("select * from category where parentId = {0}", parentId); IList <Category> list = new List <Category>(); using (DataTable dt = OleDbHelper.GetDataSet(sql)) { foreach (DataRow r in dt.Rows) { list.Add(Read(r)); } } return(list); }
public static Category GetById(int id) { string sql = string.Format("select * from category where id = {0}", id); Category inst = null; using (DataTable dt = OleDbHelper.GetDataSet(sql)) { foreach (DataRow r in dt.Rows) { inst = Read(r); } } return(inst); }