Esempio n. 1
0
        public PageOfDaTaSet DataSetPage(int Page, int PageSize, int?totalCount, string sql, params object[] args)
        {
            string sqlCount, sqlPage;

            DataSetBuildPageQueries((Page - 1) * PageSize, PageSize, sql, ref args, out sqlCount, out sqlPage);

            // Save the one-time command time out and use it for both queries
            int saveTimeout = OneTimeCommandTimeout;

            // Setup the paged result
            var result = new PageOfDaTaSet();

            result.Page           = Page;
            result.PageSize       = PageSize;
            result.Data           = new DataSet();
            result.Total          = totalCount.HasValue ? totalCount.Value : ExecuteScalar <int>(sqlCount, args);
            OneTimeCommandTimeout = saveTimeout;
            if (result.Total > 0)
            {
                Fill(result.Data, sqlPage, args);
                // Get the records
                //    result.AddRange(Fetch<T>(sqlPage, args));
            }
            // Done
            return(result);
        }
Esempio n. 2
0
        public PageOfDaTaSet DataSet(string sql, params object[] args)
        {
            // Save the one-time command time out and use it for both queries
            int saveTimeout = OneTimeCommandTimeout;
            // Setup the paged result
            var result = new PageOfDaTaSet();

            result.Data           = new DataSet();
            OneTimeCommandTimeout = saveTimeout;
            Fill(result.Data, sql, args);
            // Get the records
            //    result.AddRange(Fetch<T>(sqlPage, args));

            // Done
            return(result);
        }