Stateless search from database (Return 20 and 20 records) 
Author Message
 Stateless search from database (Return 20 and 20 records)

I am making a component and I want to use it with both win32 apps. and on
the web.

When I search the database (Oracle and SQL Server) I want to return the
first 20 records and when the user "clics" next I want to show the next 20
without having to search again.

Anyone that has any good ideas for this ?

Regards
Robert Vabo
Application developer
Gecko Informasjonssystemer AS
www.gecko.no



Tue, 28 Jan 2003 03:00:00 GMT  
 Stateless search from database (Return 20 and 20 records)
If you're using an enterprise database (RDB) such as MSSQL or Oracle, I'd
write a Stored Procedure and pass inputs of page size and page number.  Use
a server cursor to only retrieve the desired records.

-Chris Schore
Argus Connection, Inc.


Quote:
> I am making a component and I want to use it with both win32 apps. and on
> the web.

> When I search the database (Oracle and SQL Server) I want to return the
> first 20 records and when the user "clics" next I want to show the next 20
> without having to search again.

> Anyone that has any good ideas for this ?

> Regards
> Robert Vabo
> Application developer
> Gecko Informasjonssystemer AS
> www.gecko.no




Tue, 28 Jan 2003 03:00:00 GMT  
 Stateless search from database (Return 20 and 20 records)

One kinda limited way is possible if you have a sorted output that you can
use to query for values greater than the last one you got (each row has to
have a sort key though for this to work) and then only use the first X rows
from the result (if you're using SQL 7 you can use SELECT TOP - not sure if
an equivalent exists in Oracle)

e.g. MyTable contains
1    Some data
2    More Data
.
.
2000 Last row

First query is
SELECT TOP 20 FROM MyTable Where sortcolumn > 0 order by sortcolumn
Next query is
SELECT TOP 20 FROM MyTable Where sortcolumn > 20 order by sortcolumn
etc.

Being able to do this usefully is unusual and if you can't use it I believe
you're stuck with doing a larger query and discarding unwanted rows (e.g.
using a cursor in a stored proc as suggested by another poster). It is
however very useful if you have resultsets large enough to be a problem, but
you only support a limited set of canned sort-orders for your users (you can
add some columns to give a sortcolumn for each order).

- Webb Deneys


Quote:
> I am making a component and I want to use it with both win32 apps. and on
> the web.

> When I search the database (Oracle and SQL Server) I want to return the
> first 20 records and when the user "clics" next I want to show the next 20
> without having to search again.

> Anyone that has any good ideas for this ?

> Regards
> Robert Vabo
> Application developer
> Gecko Informasjonssystemeer AS
> www.gecko.no




Mon, 03 Feb 2003 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. returning first 20 records only via ASP

2. PC Install from 20/20 software

3. How to make a sinus output from 20 Hz to 20 KHz

4. HELP - Record 1 of 20

5. Display only 20 records at a time

6. HELP - Record 1 of 20

7. VB3 accessing Access 20 secure Database

8. QB45: difference between DIM a$(20) and DIM a(20) AS STRING?

9. Online Chats: Week of May 20-24

10. Combining 20+ Tables into One

11. Dividing incoming email into groups of 20

12. calculating Duration1..20

 

 
Powered by phpBB® Forum Software