with ADOTable1 do Locate('Company;Contact;Phone', VarArrayOf(['Sight Diver', 'P', '408-431-1000']), [loPartialKey]);
注意最后一个参数设置胃lopartialkey即可,可以参考DELPHI自带的帮助, function Locate(const KeyFields: String; const KeyValues: Variant; Options: TLocateOptions): Boolean; override;type TLocateOption = (loCaseInsensitive, loPartialKey); TLocateOptions = set of TLocateOption;C++ syntax:enum TLocateOption { loCaseInsensitive, loPartialKey };typedef Set<TLocateOption, loCaseInsensitive, loPartialKey> TLocateOptions;DescriptionTLocateOptions is the type of the Options parameter to a dataset抯 Locate method. The following table lists the possible values:Value DescriptionloCaseInsensitive Key fields and key values are matched without regard to case. loPartialKey Key values can include only part of the matching key field value; for example, 'HAM' would match both 'HAMM' and 'HAMMER.'
Locate('Company;Contact;Phone', VarArrayOf(['Sight Diver', 'P', '408-431-1000']), [loPartialKey]);
注意最后一个参数设置胃lopartialkey即可,可以参考DELPHI自带的帮助,
function Locate(const KeyFields: String; const KeyValues: Variant; Options: TLocateOptions): Boolean; override;type
TLocateOption = (loCaseInsensitive, loPartialKey);
TLocateOptions = set of TLocateOption;C++ syntax:enum TLocateOption { loCaseInsensitive, loPartialKey };typedef Set<TLocateOption, loCaseInsensitive, loPartialKey> TLocateOptions;DescriptionTLocateOptions is the type of the Options parameter to a dataset抯 Locate method. The following table lists the possible values:Value DescriptionloCaseInsensitive Key fields and key values are matched without regard to case.
loPartialKey Key values can include only part of the matching key field value; for example, 'HAM' would match both 'HAMM' and 'HAMMER.'