Pagination in SQL


/ Published in: C#
Save to your folder(s)

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


Copy this code and paste it in your HTML
  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);

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.