-1

I have 20000 products in DB. Want to show 20 on load and rest others onclick button. I dont want to load all the 20000 initially. Please advise

sujith karivelil
  • 27,818
  • 6
  • 51
  • 82

3 Answers3

1

You can use something like

SELECT TOP 20 * FROM yourTable; 

This link gives more information about Top

sujith karivelil
  • 27,818
  • 6
  • 51
  • 82
1

You can use linq instead, since it does not bother about the syntax that the db expects(using LIMIT/TOP in select query).

var query=(from c in context.yourTable
           select c).Take(20).AsNoTracking().ToList();
Nikita Shrivastava
  • 2,918
  • 8
  • 19
0

Select * from ( Select row_number() Over(Order by Columnname) rw,* from Tablename ) t where t.rw between 1 and 20