public IList<Student> GetStudentByPage(int pageSize, int pageIndex, string SName)
        {
            ISession session = NHibernateHelper.GetCurrentSession();
            ITransaction trans = session.BeginTransaction();
            //HQL查询
            IList<Student> studentList = new List<Student>();
            //string sql = "from Student";
            //studentList = session.CreateQuery(sql)
            //    .SetFirstResult((pageIndex - 1) * pageSize)
            //    .SetMaxResults(pageSize)
            //    .List<Student>();

            //SQL查询

            //studentList = session.CreateSQLQuery("SELECT * FROM Student")
            //    .SetFirstResult((pageIndex - 1) * pageSize)
            //    .SetMaxResults(pageSize)
            //    .SetResultTransformer(Transformers.AliasToBean<Student>()).List<Student>();
            return studentList;
        }
View Code

相关文章:

  • 2021-05-18
  • 2022-03-11
  • 2021-12-19
  • 2021-08-05
  • 2021-07-27
  • 2022-12-23
  • 2022-12-23
  • 2021-10-11
猜你喜欢
  • 2021-11-25
  • 2021-10-14
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案