Пример #1
0
        /// <summary>
        /// 分页获取数据列表
        /// </summary>
        /// <param name="PageSize"></param>
        /// <param name="PageIndex"></param>
        /// <param name="strWhere"></param>
        /// <returns></returns>
        public DataSet GetList(int PageSize, int PageIndex, string strWhere, string tablename, string keyname)
        {
            SqlParameter[] parameters =
            {
                new SqlParameter("@tblName",   SqlDbType.VarChar,  255),
                new SqlParameter("@fldName",   SqlDbType.VarChar,  255),
                new SqlParameter("@PageSize",  SqlDbType.Int),
                new SqlParameter("@PageIndex", SqlDbType.Int),
                new SqlParameter("@IsReCount", SqlDbType.Bit),
                new SqlParameter("@OrderType", SqlDbType.Bit),
                new SqlParameter("@strWhere",  SqlDbType.VarChar, 1000),
            };
            parameters[0].Value = tablename;
            parameters[1].Value = keyname;
            parameters[2].Value = PageSize;
            parameters[3].Value = PageIndex;
            parameters[4].Value = 0;
            parameters[5].Value = 1;
            parameters[6].Value = strWhere;
            DataSet ds  = DBHelperSQL.RunProcedure("sp_GetRecordByPage", parameters, "ds");
            int     num = ds.Tables[0].Rows.Count;

            return(ds);
        }
Пример #2
0
        public TEntity GetEntityByProcedure <TEntity>(string procedureName, params SqlParameter[] parameters) where TEntity : class, new()
        {
            DataSet ds = dbHelperSQL.RunProcedure(procedureName, parameters);

            return(GetEntityByProcedure <TEntity>(ds));
        }