I assume that you use Perl, otherwise you will not post it here, ;-) (I also assume you use Win32::ODBC).

If I didn't misunderstand your "paginate", I think you mean batch fetching, which is a standard term being used to mean "to fetch multiple rows by issuing one operation".

I don't think Win32::ODBC support this, however you can wrap around its FetchRow function, and create your own FetchRows.

However you have to remember that this gives you the feeling of batch fetching, but it does not improve performance at all, as it does not reduce network travel time, as real batch fetching does.

If you just want "paginate", this function does give it to you. An advantage of this implementation is that it is generic, you do it once, it can be used for any similar purposes without modification.
use Win32::ODBC; use Data::Dumper; use strict; my $Data = new Win32::ODBC("myDSN") || die "failed\n"; $Data->Run("DROP TABLE test1"); $Data->Run('CREATE TABLE test1(a number, b char(1))'); for (1..50) { my $statement = "INSERT INTO test1 VALUES($_, ' ')"; $Data->Run($statement); } $Data->Sql("SELECT * FROM test1"); while (1) { my @Rows = FetchRows($Data, 4);#fetch 4 rows each time print Dumper(\@Rows); last if $Rows[0];#$Rows[0] is used to indicate whether we reached +the end of active dataset } sub FetchRows { my ($Connection, $Rows) = @_; my @Rows; push @Rows, 0; # for (1..$Rows) { if ($Data->FetchRow()) { my %hash = $Data->DataHash(); push @Rows, \%hash; } else { $Rows[0] = 1; } } return @Rows; }
Update:

Thanks, poj. No that is not correct. That comment is added on fly, and I fixed it. However THE SOLUTION ITSELF IS TESTED, so no worry.

In reply to Re: MS Access Pagination by pg
in thread MS Access Pagination by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.