CREATE PROCEDURE  page_getperson
(
  _pageIndex INT,
  _pageSize INT,
  out _pagecount int
)
BEGIN

DECLARE startIndex int DEFAULT 0;
DECLARE tcount int DEFAULT 0;
set startIndex=(_pageIndex-1)*_pageSize;
SELECT * from Person LIMIT startIndex,_pageSize;
SELECT COUNT(id) into tcount from Person;
set _pagecount=tcount;

END

参数写法:

DynamicParameters param = new DynamicParameters();
  param.Add("_pageIndex", 2);
  param.Add("_pageSize", 5);
  param.Add("_pagecount", dbType: DbType.Int32, direction: ParameterDirection.Output);
  var result = mysql.FindToListByPage<Person>(connection, "page_getperson", param);
  //总条数
  var count = param.Get<int>("_pagecount");
  var kk = result;

相关文章:

  • 2021-09-21
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-06-12
  • 2022-12-23
  • 2022-12-23
  • 2021-12-04
相关资源
相似解决方案