Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
Yonkouturko
Yak Posting Veteran
59 Posts |
Posted - 2013-05-14 : 05:44:33
|
Im creating an Application In vb.net winformsnow im using stored procedure.. i'm working with over 1000 records in one table..and when viewing that records in a datagridview in vb.net2010, the system slows downs because of the number of records viewedi figured out that PAGINATION will solve my problem..ive used the TOP(n) CLAUSE but the it does not fit as my solution hence it cannot show records other than the n Specified .. any help building my idea will be entertained or any link to any solution will be entertained and i'd be thankful for it! |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
|
UnemployedInOz
Yak Posting Veteran
54 Posts |
Posted - 2013-05-16 : 02:29:43
|
-- some examples I think you may be trying to get toSELECT orderid, orderdate, custid, empidFROM Sales.OrdersORDER BY orderdate DESC, orderid DESCOFFSET 0 ROWS FETCH FIRST 25 ROWS ONLY;-------------------------------------------------------------DECLARE @pagesize AS BIGINT = 25, @pagenum AS BIGINT = 3;SELECT orderid, orderdate, custid, empidFROM Sales.OrdersORDER BY orderdate DESC, orderid DESCOFFSET (@pagenum - 1) * @pagesize ROWS FETCH NEXT @pagesize ROWS ONLY; |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2013-05-16 : 02:44:19
|
quote: Originally posted by UnemployedInOz -- some examples I think you may be trying to get toSELECT orderid, orderdate, custid, empidFROM Sales.OrdersORDER BY orderdate DESC, orderid DESCOFFSET 0 ROWS FETCH FIRST 25 ROWS ONLY;-------------------------------------------------------------DECLARE @pagesize AS BIGINT = 25, @pagenum AS BIGINT = 3;SELECT orderid, orderdate, custid, empidFROM Sales.OrdersORDER BY orderdate DESC, orderid DESCOFFSET (@pagesize@pagenum - 1) * @pagesize ROWS FETCH NEXT @pagesize ROWS ONLY;
slight tweak to make output correct------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/https://www.facebook.com/VmBlogs |
|
|
|
|
|
|
|