![]() | ![]() Products ![]() ![]() ![]() ![]() |
Home » Technical Support » DBISAM Technical Support » Product Manuals » DBISAM Version 4 Manual for RAD Studio XE (Delphi) » Using DBISAM » Searching and Sorting Tables and Query Result Sets |
begin with MyTable do begin IndexName:='CustomerName'; { do something } end; end;
begin with MyTable do begin IndexFieldNames:='CustomerName;CustomerNo'; { do something } end; end;
begin with MyTable do begin { Set to the primary index } IndexName:=''; { Search for customer 100 } if FindKey([100]) then { Record was found, now do something } else ShowMessage('Record was not found'); end; end;
begin with MyTable do begin { Set to the primary index } IndexName:=''; { Search for customer 100 or closest } FindNearest([100]); end; end;
begin with MyTable do begin { Set to the CustomerName secondary index } IndexName:='CustomerName'; { Search for the customer with the name 'The Hardware Store' } SetKey; FieldByName('CustomerName').AsString:='The Hardware Store'; { This causes the search to only look at the first field in the current index when searching } KeyFieldCount:=1; if GotoKey then { Record was found, now do something } else ShowMessage('Record was not found'); end; end;
begin with MyTable do begin { Set to the CustomerName secondary index } IndexName:='CustomerName'; { Search for the customer with the name 'The Hardware Store' } SetKey; FieldByName('CustomerName').AsString:='The Hardware Store'; { This causes the search to only look at the first field in the current index when searching } KeyFieldCount:=1; GotoNearest; end; end;
begin with MyTable do begin { Search for the customer with the name "The Hardware Store" } if Locate('CustomerName',['The Hardware Store'],[]) then { Record was found, now do something } else ShowMessage('Record was not found'); end; end;
begin with MyTable do begin { Search for the customer with the name "The Hardware Store" } if Locate('CustomerName',['The Hardware Store'], [loCaseInsensitive]) then { Record was found, now do something } else ShowMessage('Record was not found'); end; end;
begin with MyTable do begin { Search for the first customer with the name "The Hardware Store" } Filter:='CustomerName='+QuotedStr('The Hardware Store'); { We want the search to be case-insensitive } FilterOptions:=[foCaseInsensitive]; if FindFirst then begin { Record was found, now search through the rest of the matching records } while FindNext do { Do something here } end else ShowMessage('Record was not found'); end; end;
This web page was last updated on Friday, January 20, 2023 at 07:13 AM | Privacy Policy![]() © 2023 Elevate Software, Inc. All Rights Reserved Questions or comments ? ![]() |