aspnetpager调用存储过程方法

风流意气都作罢 提交于 2020-03-24 07:23:44

 /// <summary>
        /// 多表分页
        /// </summary>
        /// <param name="tblName">主表名</param>
        /// <param name="ftblname">从表名</param>
        /// <param name="Cfields">从表字段</param>
        /// <param name="fldName">主表主键</param>
        /// <param name="fldnamefk">主表外键</param>
        /// <param name="ftablenamepk">从表主键</param>
        /// <param name="PageSize">分页大小</param>
        /// <param name="PageIndex">当前页</param>
        /// <param name="strOrder">排序方式</param>
        /// <param name="strWhere">查询条件</param>
        /// <param name="strTerm">主表字段</param>
        /// <param name="Count">返回记录的总数</param>
        /// <returns></returns>
        public static DataSet GetmuchList(string tblName, string ftblname, string Cfields, string fldName, string fldnamefk, string ftablenamepk, int PageSize, int PageIndex, string strOrder, string strWhere, string strTerm, out int Count)
        {
            SqlParameter[] parameters = {
     new SqlParameter("@tblName", SqlDbType.VarChar, 255),
                    new SqlParameter("@ftblname", SqlDbType.VarChar, 255),
                    new SqlParameter("@strGetFields", SqlDbType.VarChar, 1000),
                    new SqlParameter("@fstrfieldes", SqlDbType.VarChar, 1000),
     new SqlParameter("@fldName", SqlDbType.VarChar, 255),
                    new SqlParameter("@fldnamefk", SqlDbType.VarChar, 255),
                    new SqlParameter("@ftablenamepk", SqlDbType.VarChar, 255),
     new SqlParameter("@PageSize", SqlDbType.Int),
     new SqlParameter("@PageIndex", SqlDbType.Int),     
     new SqlParameter("@strOrder", SqlDbType.VarChar,1000),
     new SqlParameter("@strWhere", SqlDbType.VarChar,1500),
                    new SqlParameter("@Count", SqlDbType.Int),
     };
            parameters[0].Value = tblName;
            parameters[1].Value = ftblname;
            parameters[2].Value = strTerm;
            parameters[3].Value = Cfields;
            parameters[4].Value = fldName;
            parameters[5].Value = fldnamefk;
            parameters[6].Value = ftablenamepk;
            parameters[7].Value = PageSize;
            parameters[8].Value = PageIndex;
            parameters[9].Value = strOrder;
            parameters[10].Value = strWhere;
            parameters[11].Direction = ParameterDirection.Output;

            DataSet ds = SqlConnStr.RunProcedure("pagemuchtable", parameters, "ds");

            Count = int.Parse(parameters[11].Value.ToString());

            return ds;
        }

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!