Posted By

tomaszsimon on 12/15/09


Tagged

sql pagination datatable


Versions (?)

Pagination in SQL


 / Published in: C#
 

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);

Report this snippet  

You need to login to post a comment.