Board index » delphi » Locate Next?

Locate Next?

Is there a way to have a TADODataSet do a find next?  AFAIK, Locate doesn't
do Next, only First.  Is there another method that handles Next?

I've tried several 3rd party searches ( InfoPowr being the latest ), but the
Locate function is always the fastest, hands down.

Thanks,
Paul

 

Re:Locate Next?


Quote
> Is there a way to have a TADODataSet do a find next?  AFAIK, Locate doesn't
> do Next, only First.  Is there another method that handles Next?

procedure TForm1.Button1Click(Sender: TObject);
  Var RS: _Recordset;
begin
  RS := ADODataSet1.Recordset.Clone(adLockUnspecified);
  RS.Filter := 'Some filter';
  RS.MoveFirst;
  While Not RS.EOF Do Begin
    ADODataSet1.Recordset.Bookmark := RS.Bookmark; //Optional
    ...//Do some work
    RS.MoveNext;
    End;
end;

HTH
--
Vassil Nazarov
http://web.orbitel.bg/vassil/

Re:Locate Next?


Quote
>Is there a way to have a TADODataSet do a find next?  AFAIK, Locate doesn't
>do Next, only First.  Is there another method that handles Next?

No.  But internally Locate creates a filter.  You can create your own filter to
match what you would locate on then just move to the next record to find the
next value that matches.

--
Brian Bushay (TeamB)
Bbus...@NMPLS.com

Re:Locate Next?


Thank you for the assistance.  It works great!

"Paul G. Gardner" <p.gard...@stanleyassociates.com> wrote in message
news:3bdf29b6_2@dnews...

Quote
> Is there a way to have a TADODataSet do a find next?  AFAIK, Locate
doesn't
> do Next, only First.  Is there another method that handles Next?

> I've tried several 3rd party searches ( InfoPowr being the latest ), but
the
> Locate function is always the fastest, hands down.

> Thanks,
> Paul

Other Threads