Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Paging VFP Data
Message
 
To
10/02/2002 10:23:22
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Miscellaneous
Thread ID:
00618013
Message ID:
00618019
Views:
21
Hi Mike

I do this with Sql server but i guess it would also work with VFP data, what you need is a key an an order by clause. The client need to know about the last key he received.

The statement would look like this:
Select TOP 10 * From SomeTable Where YourKeyField > ? Order By YourKeyField
In my client i keep an array of The last key field received if the user press on "previous". When using the TOP clause, i always use order by to make sure i receive consistant data, using TOP with no order by does not always return the same rows even if the data haven't changed.


>Hey All,
>
>How do you do paging with Fox Data? Paging, or block cursors, or whatever you want to call them is getting record 1-10, 11-20, 21-30, ect. like a web search engine would list its results.
>
>I tried something like:
>
>
SELECT TOP 10 field FROM cursor ORDER BY 1 ;
>     WHERE field NOT IN (SELECT TOP 30 field FROM cursor ORDER BY 1)
>
>So that would get top 10 results that aren't in the top 30 results, resulting in records 31-40... but I don't think VFP likes that. I'm trying to get it to one SQL Select statement, cause I'm using the OLE-DB Providor to get at the data. I know, I coudl use Stored Procedures, but currently the tables are free, and it would be nice to not change that.
>
>I figured that the next best thing woudl be to get the TOP 10*page and just ignore what I don't need. So in order to display the first 10 records of a 30,000 record table, I would do a TOP 10. To get 11-20 I would just do a TOP 20 and ignore the first 10 on the client side. That would probably cut down on the data coming down the pike.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform