标签:dal ndt EDA help cut com params set command
public Pages<stuclass> GetStudetPage(PageParams pagePar)
{
int size = pagePar.PageSize;
string sql = "[dbo].[p_paging]";
SqlParameter[] par = new SqlParameter[]
{
new SqlParameter("@tableName", pagePar.TableName),
new SqlParameter("@indexCol", pagePar.IndexCol),
new SqlParameter("@pageSize", pagePar.PageSize),
new SqlParameter("@pageIndex", pagePar.PageIndex),
new SqlParameter("@orderCol", pagePar.OrderCol),
new SqlParameter("@where", pagePar.Where),
new SqlParameter("@columns", pagePar.Columns)
};
DataSet ds = DbHelperSQL.ExecuteDataset(DbHelperSQL.ConnB2c, CommandType.StoredProcedure, sql, par);
DataTable dt = ds.Tables[0];
int count =Convert.ToInt32( ds.Tables[1].Rows[0] [0]);
Pages<stuclass> pagse = new Pages<stuclass>();
pagse.list = JsonConvert.DeserializeObject<List<stuclass>>(JsonConvert.SerializeObject(dt));
pagse.SumCount = count;
pagse.SumPage = (count % size > 0 ? ((count / size) + 1) : (count / size));
return pagse;
}
标签:dal ndt EDA help cut com params set command
原文地址:https://www.cnblogs.com/fsl123/p/9387581.html