예제 #1
0
        /// <summary>
        /// GetPageData
        /// </summary>
        /// <param name="where"></param>
        /// <param name="fields"></param>
        /// <param name="orderExp"></param>
        /// <param name="pageindex"></param>
        /// <param name="pagesize"></param>
        /// <returns></returns>
        public int GetPageData(out DataTable dt, string where, string fields, string orderExp, int pageindex, int pagesize)
        {
            /*
             * set @where = '1=1'
             * set @fields = '*'
             * set @OrderExp = '[ID] ASC'
             * set @pageIndex=1
             * set @pageSize=10
             */
            if (where.Trim() + "" == "")
            {
                where = "1=1";
            }

            SqlParameter[] prams =
            {
                SqlParameterHelper.MakeInParam("@OrderExp",  SqlDbType.NVarChar, 0, orderExp),
                SqlParameterHelper.MakeInParam("@fields",    SqlDbType.NVarChar, 0, fields),
                SqlParameterHelper.MakeInParam("@where",     SqlDbType.NVarChar, 0, where),

                SqlParameterHelper.MakeInParam("@pageSize",  SqlDbType.Int,      0, pagesize),
                SqlParameterHelper.MakeInParam("@pageIndex", SqlDbType.Int,      0, pageindex),
                SqlParameterHelper.MakeParam("@RecsCount",   SqlDbType.Int,      0, ParameterDirection.Output, null)
            };
            DataSet ds = SqlHelper.ExecuteDataset("", "[officedba].[MessageSendBox_GetPageData]", prams);

            dt = ds.Tables[0];
            return(Convert.ToInt32(prams[prams.Length - 1].Value));
        }
예제 #2
0
        /// <summary>
        /// GetPageData
        /// </summary>
        /// <param name="table"></param>
        /// <param name="key"></param>
        /// <param name="where"></param>
        /// <param name="fields"></param>
        /// <param name="orderExp"></param>
        /// <param name="pageindex"></param>
        /// <param name="pagesize"></param>
        /// <returns></returns>
        public int GetPageData(out DataTable dt, string where, string fields, string orderExp, int pageindex, int pagesize)
        {
            /*
             * set @table='[officedba].VflowMyApply'
             * set @keyfield = '[ID]'
             * set @where = '1=1'
             * set @fields = '*'
             * set @OrderExp = '[ID] ASC'
             * set @pageIndex=1
             * set @pageSize=10
             */
            if (where.Trim() + "" == "")
            {
                where = "1=1";
            }
            string table = "officedba.MobileMsgMonitor";
            string key   = "[ID]";

            SqlParameter[] prams =
            {
                SqlParameterHelper.MakeInParam("@table",     SqlDbType.NVarChar, 0, table),
                SqlParameterHelper.MakeInParam("@keyfield",  SqlDbType.NVarChar, 0, key),
                SqlParameterHelper.MakeInParam("@OrderExp",  SqlDbType.NVarChar, 0, orderExp),
                SqlParameterHelper.MakeInParam("@fields",    SqlDbType.NVarChar, 0, fields),
                SqlParameterHelper.MakeInParam("@where",     SqlDbType.NVarChar, 0, where),

                SqlParameterHelper.MakeInParam("@pageSize",  SqlDbType.Int,      0, pagesize),
                SqlParameterHelper.MakeInParam("@pageIndex", SqlDbType.Int,      0, pageindex),
                SqlParameterHelper.MakeParam("@RecsCount",   SqlDbType.Int,      0, ParameterDirection.Output, null)
            };
            DataSet ds = SqlHelper.ExecuteDataset("", "[dbo].GetPageData", prams);

            dt = ds.Tables[0];
            return(Convert.ToInt32(prams[prams.Length - 1].Value));
        }