/// <summary> /// 获取列表 /// </summary> /// <param name="categoryId">分类编号</param> /// <param name="startIndex">起始索引</param> /// <param name="count">取出数目</param> public static IList <BlogQuestion> GetList(Guid categoryId, int startIndex, int count) { IList <BlogQuestion> list = new List <BlogQuestion>(); using (DbDataReader rd = DataHelper.GetPageList("fbs_BlogQuestion", "CreationDate DESC", categoryId == Guid.Empty ? null : ("CategoryID='" + categoryId.ToString() + "'"), startIndex, count)) { while (rd.Read()) { list.Add(BlogQuestion.CreateFromReader(rd)); } } return(list); }
public static HashSet <BlogQuestion> GetAllQuestions() { string sql = "select * from fbs_BlogQuestion as b inner join fbs_BlogQuestionCategory as c on b.CategoryID=c.QuestionCategoryID order by CreationDate asc"; HashSet <BlogQuestion> list = new HashSet <BlogQuestion>(); using (DbDataReader rd = DataHelper.ExecuteReader(CommandType.Text, sql)) { while (rd.Read()) { list.Add(BlogQuestion.CreateFromReader(rd)); } } return(list); }