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 howLocate
is implemented.For a single condition it uses RecordSet
Find
method. for multiple conditions it uses theFilter
property.Using
Find
is fairly easy:Since
TADOQuery
is aTCustomADODataSet
descendant there is no problem usingRecordSet
same asTADODataSet