How can we use locate function or a same operation function using a calculated field in delphi Tadotable? something like this
SampleAdotable.locate('samplefield',text,[lopartialkey]);
where samplefield is a calculated field in SampleAdotable.In normal case an exception with this message is created:
Item can not be found in the collection corresponding to the requested name or ordinal
thank you
If your SampleField
is of type fkCalculated
, I don't think you can use this field as a field whose value you try to locate in a call to Locate
.
The reason is that Locate
calls TCustomADODataSet.LocateRecord
which generates the error you quote and the reason it does is that SampleField
is not a field in the ADO Recordset
underlying the TCustomADODataSet
. The exception occurs in the call to Cursor.MoveNext
.
To do what you want, try constructing a calculated field in the SQL expression used to obtain the row data from the database. Depending on the server you are using, you may need to use a TAdoQuery instead of a TAdoTable to get the rows.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With