Esempio n. 1
0
        // Liujun Add at 2007-6-19 将分页存储过程提取到基类,供查询时使用

        /// <summary>
        /// 计算总页数
        /// </summary>
        /// <param name = "strFromStatement"></param>
        /// <param name = "strWhereStatement"></param>
        /// <returns></returns>
        public int SelectListPagedTotalCount(string strFromStatement, string strWhereStatement)
        {
            try
            {
                /// 传递存储过程参数
                string[] sParameter = new string[] { "SelectStatement", "FromStatement", "WhereStatement", "OrderByExpression", "AscOrDesc", "RecordCount", "PageIndex", "PageSize", "DoCount" };

                /// 传递存储过程参数值
                Object[] sParameterValue = new object[] { DBNull.Value, strFromStatement, strWhereStatement, DBNull.Value, DBNull.Value, DBNull.Value, DBNull.Value, DBNull.Value, true };

                SqlDbType[] sqlDbTypeValue = new SqlDbType[] { SqlDbType.NVarChar, SqlDbType.NVarChar, SqlDbType.NVarChar, SqlDbType.NVarChar, SqlDbType.NVarChar, SqlDbType.Int, SqlDbType.Int, SqlDbType.Int, SqlDbType.Bit };

                DataSet DS = _da.ExecuteSPQuery("spSelectListDynamicPaged2", sParameter, sParameterValue, sqlDbTypeValue);

                //return the total count
                return(Convert.ToInt32(DS.Tables[0].Rows[0][0].ToString()));
            }
            catch (System.Exception err)
            {
                throw(err);
            }
        }