Return to Snippet

Revision: 21507
at December 15, 2009 04:47 by tomaszsimon


Updated Code
DataTable dtAllProductsView = DB.GetData(@"
   SELECT TOP " + itemsNb + @" * 
	FROM 
		(SELECT
		   ROW_NUMBER() OVER (ORDER BY id) AS RowNumber,
		   *
		FROM
		   [vwAllProductData]
		WHERE
			[" + promotion + @"] LIKE 'True' AND 
			active = 'True'
		) _rowNbResult                
	WHERE 
		RowNumber >  " + CurrentPage + @" * " + itemsNb);

Revision: 21506
at December 15, 2009 04:37 by tomaszsimon


Initial Code
DataTable dtAllProductsView = DB.GetData(@"
                SELECT TOP " + itemsNb + @" * 
                FROM 
	                (SELECT
	                   ROW_NUMBER() OVER (ORDER BY id) AS RowNumber,
	                   *
	                FROM
	                   [vwAllProductData]
                    WHERE
                        [" + promotion + @"] LIKE 'True' AND 
	                    active = 'True'
                    ) _rowNbResult                
                WHERE 
	                RowNumber >  " + CurrentPage + @" * " + itemsNb);

Initial URL

                                

Initial Description
Call it in the button click event after in(de)crementing CurrentPage value

Initial Title
Pagination in SQL

Initial Tags
sql

Initial Language
C#