Subject Re: [IBO] Walking through a Resultset with IB_Query
Author Helen Borrie
At 02:19 PM 23-08-01 +0000, you wrote:
>Hi All,
>
>i have the following problem and i wonder if there is a solution.
>Walking through a Resultset i need to start with the end of the Result
>set, because i'll show the last received items of our "News-System"
>Therefore i make a Query like this "SELECT* from ItemTable WHERE
>Create_DATE = 'today'";
>
>Now would like to go the last Record with
>IB_QUERY1->Last() and then
>go back for example with:
>
> while (count < 20)
> {
> IB_Query1->Prior();
>MyStringList->Add(IB_Query1->FieldByName( "MLDIndex" )->AsString);
> }
>
>But using IB_Query->Last() means that all the RecordSets will be
>transferd to the client.
>Is there a way ??!
Gerhard,
Get the specific rows you want into your output set and order them in the sequence in which you want to display them.

If your only object is to load that column "MLIndex" into a stringlist, just use an ib_cursor with the statement
SELECT Create_Date, MLIndex from ItemTable
WHERE Create_DATE = 'today'
ORDER BY MLIndex DESC
or whatever you need...

Then just call the ib_cursor's .First method (not .Open) and step through until you have enough items in your stringlist.

Of course, if you need the dataset to be bi-directional for some other purpose (e.g. displaying in an ib_grid for browsing) then it will be a bit different. But still SELECT the output in the order by which you want to handle it and avoid fetching columns that you don't need.

cheers,
helen




All for Open and Open for All
InterBase Developer Initiative ยท http://www.interbase2000.org
_______________________________________________________