Wednesday 7 July, 2010

PAGINATION IN SQL

  1. Call it in the button click event after in(de)crementing CurrentPage value

    1. DataTable dtAllProductsView = DB.GetData(@"
    2. SELECT TOP " + itemsNb + @" *
    3. FROM
    4. (SELECT
    5. ROW_NUMBER() OVER (ORDER BY id) AS RowNumber,
    6. *
    7. FROM
    8. [vwAllProductData]
    9. WHERE
    10. [" + promotion + @"] LIKE 'True' AND
    11. active = 'True'
    12. ) _rowNbResult
    13. WHERE
    14. RowNumber > " + CurrentPage + @" * " + itemsNb);

No comments:

Post a Comment