Find a record in which page where pages are generated using ADO pagination

S

sean

I have a table with fixed row of records SORTED by DATE using ADO pagination
method. The user can click a link in one table cell and go to another page
to modify the record. Once the updated record is saved the user will be
redirect back to the table. This time the record updated will be highlighted
so that the user knows where he came from. I basically pass the page number,
column and row number via querystring and store the info in a session so
when the page goes back to the table I know where to hightlight. That all
goes fine until....the user modified the DATE. Because the table is sorted
by date the updated record won't be in the same physical location anymore
:((. The updated record might show in several pages after or before. However
the user still wants to see the record highlighted yet I don't really know
the exact page number the updated record is on.

I could re-query the whole database and find where the record is and
calculate out the page number but it's apparently not very efficient and the
perfomance will suffer when there are tens of thousands of records.

Anyone has better idea? I'd appreciate it very much for some guidance here.

Schen
 
B

Bob Barrows [MVP]

sean said:
I have a table with fixed row of records SORTED by DATE using ADO
pagination method. The user can click a link in one table cell and go
to another page to modify the record. Once the updated record is
saved the user will be redirect back to the table. This time the
record updated will be highlighted so that the user knows where he
came from. I basically pass the page number, column and row number
via querystring and store the info in a session so when the page goes
back to the table I know where to hightlight. That all goes fine
until....the user modified the DATE. Because the table is sorted by
date the updated record won't be in the same physical location
anymore :((. The updated record might show in several pages after or
before. However the user still wants to see the record highlighted
yet I don't really know the exact page number the updated record is
on.

I could re-query the whole database and find where the record is and
calculate out the page number but it's apparently not very efficient
and the perfomance will suffer when there are tens of thousands of
records.

Anyone has better idea? I'd appreciate it very much for some guidance
here.
I don't believe you can avoid requerying the database, even if you do take
the correct step of using the database table's actual primary key to
identify the row being edited. The only way you could avoid requerying is if
you have the entire table cached in the web server's memory (or in a file),
so you could re-apply the sort after the edit and find the record in the
cached data. Given the table's size, you probably will not be able to cache
its entire contents, which means requerying the database to determine the
page in which the edited record will appear.

Bob Barrows
 
S

sean

Thanks a lot for clarifying that.

Bob Barrows said:
I don't believe you can avoid requerying the database, even if you do take
the correct step of using the database table's actual primary key to
identify the row being edited. The only way you could avoid requerying is
if
you have the entire table cached in the web server's memory (or in a
file),
so you could re-apply the sort after the edit and find the record in the
cached data. Given the table's size, you probably will not be able to
cache
its entire contents, which means requerying the database to determine the
page in which the edited record will appear.

Bob Barrows
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,186
Latest member
vinaykumar_nevatia

Latest Threads

Top