Click here to Skip to main content
15,887,683 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
I use a webservice which retrieve data from database.For some search criteria,it retrieves more than 200 records.

My query is
1) i want to retrieve only 150 records at a time.
2)when the user clicks next,The next 150 records have to be displayed in grid view.

also I dont want to retrieve all the records at once(Is this possible?)

Any idea how to implement the same?

Thanks in advance..
Posted

See this[^] article on paging. It may help.
 
Share this answer
 
Comments
bsb25 12-May-11 9:31am    
thank u dude.....this is what i wanted.
fjdiewornncalwe 12-May-11 10:01am    
Please Accept Abhinav's answer if it was helpful.
Abhinav S 12-May-11 10:23am    
Thanks Marcus. Very good point. :)
What code do you already have? Have you written your stored procs in the database? Have you written the web service that calls the stored procs in the database? Have you written the client app that calls the web service that calls the stored procs in the database?

I feel like Dr. Seuss...
 
Share this answer
 
Comments
bsb25 12-May-11 8:48am    
currently my webservice retrieves records from the respective tables.the client app is also been done...
#realJSOP 12-May-11 8:49am    
I'm not going to continue trying to help until you remove the 1 vote.
bsb25 12-May-11 8:53am    
sorry,you really pissed me off,with that comment of yours...
#realJSOP 12-May-11 9:02am    
With what comment? Have you ever read a Dr. Seuss book?
bsb25 12-May-11 9:04am    
yes i have read the book..no one is perfect,Bro...everyone is here to learn something.If you know the answer plz share it..otherwize dont....
SQL
WITH temp AS
(
Select Row_Number()  OVER(Order By Customer_Account_Code) as RowThing , * FROM CUSTOMER_ACCOUNT  
)
Select * FROM temp WHERE RowThing BETWEEN 50 AND 60


You will have to work it differently with your DataBase.

But that seems to work.
 
Share this answer
 
v3
Comments
bsb25 12-May-11 8:43am    
am using sql 2005 server
Rob Branaghan 12-May-11 9:23am    
Try that now
Rob Branaghan 12-May-11 9:30am    
bsb25 Check my solution, if you add this to your stored procedure / function, you can set the 50 and 60 to be two parameters. so you could say select where rowthing between x and y.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900