Пример #1
0
        public Array getSearchResult(string CurrentPage)
        {
            if (keywork == null)
            {
                return(null);
            }
            int c;

            if (int.TryParse(CurrentPage, out c))
            {
                currentPage = c;
            }
            if (currentPage >= 1)
            {
                currentPage = currentPage - 1;
            }
            if (currentPage < 0)
            {
                currentPage = 0;
            }
            int d = currentPage * recordPerPage;

            query  = "SELECT * FROM dbo.Product WHERE ";
            query += " name LIKE '%" + keywork + "%' ";
            query += " OR tag_name LIKE '%" + keywork + "%' ORDER BY id  OFFSET  " + d + " ROWS FETCH NEXT " + recordPerPage + " ROWS ONLY ";
            return(connect.getData(query));
        }
Пример #2
0
        public Array getData(string CurrentPage = "0")
        {
            int c;

            if (int.TryParse(CurrentPage, out c))
            {
                currentPage = c;
            }
            if (currentPage >= 1)
            {
                currentPage = currentPage - 1;
            }
            if (currentPage < 0)
            {
                currentPage = 0;
            }
            int    d     = currentPage * recordPerPage;
            string query = "SELECT  * FROM     dbo.Product ORDER BY id  OFFSET  " + d + " ROWS FETCH NEXT " + recordPerPage + " ROWS ONLY ";

            return(connect.getData(query));
        }