In this question:
Delphi ADO : Locate with dataset filter on bug
an ADO bug was described where the Filter string is ignored during .Locates.
This is causing problems for us migrating from the BDE because we have a lot of code that changes the filter according to user input.
We had expected TADOQuery to provide a working migration path. We were wrong.
We can of course change our current filters to WHERE statements, but that's a lot of work and risk concatenating the filter strings to filter-less WHERE statements, etc.
The accepted answer to the question linked to above suggests the possibility of using TCustomADODataSet.Recordset.Find
Can we safely use RecordSet.Find in a TADOQuery just to implement .Locates? i.e. Does RecordSet.Find update whatever wrapper TADOQuery puts around TADOQuery?
If so, can someone show a sample call from Delphi XE5 to RecordSet find? I'm having trouble figuring out the arguments.
Your best option is to look at the source code of ADODB.pas
TCustomADODataSet.LocateRecord. You will see howLocateis implemented.For a single condition it uses RecordSet
Findmethod. for multiple conditions it uses theFilterproperty.Using
Findis fairly easy:Since
TADOQueryis aTCustomADODataSetdescendant there is no problem usingRecordSetsame asTADODataSet