Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » ElevateDB Technical Support » Product Manuals » ElevateDB Version 2 Manual for RAD Studio XE3 (Delphi Win32) » Using ElevateDB » Searching and Sorting Tables, Views, 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 natural order, which in this case is the primary key } IndexName:=''; { Search for customer 100 } if FindKey([100]) then { Row was found, now do something } else ShowMessage('Row was not found'); end; end;
begin with MyTable do begin { Set to the natural order, which in this case is the primary key } IndexName:=''; { Search for customer 100 or closest } FindNearest([100]); end; end;
begin with MyTable do begin { Set to the CustomerName index } IndexName:='CustomerName'; { Search for the customer with the name 'The Hardware Store' } SetKey; ColumnByName('CustomerName').AsString:='The Hardware Store'; { This causes the search to only look at the first column in the current index when searching } KeyColumnCount:=1; if GotoKey then { Row was found, now do something } else ShowMessage('Row was not found'); end; end;
begin with MyTable do begin { Set to the CustomerName index } IndexName:='CustomerName'; { Search for the customer with the name 'The Hardware Store' } SetKey; ColumnByName('CustomerName').AsString:='The Hardware Store'; { This causes the search to only look at the first column in the current index when searching } KeyColumnCount:=1; GotoNearest; end; end;
CREATE INDEX State ON Customer (State)
begin with MyTable do begin { Search for the customer with the state "FL" } if Locate('State',['FL'],[loCaseInsensitive]) then { Row was found, now do something } else ShowMessage('Row was not found'); end; end;
CREATE INDEX State ON Customer (State)
begin with MyTable do begin { Search for the customer with the state "FL" } if Locate('State',['FL'],[]) then { Row was found, now do something } else ShowMessage('Row 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 { Row was found, now search through the rest of the matching rows } while FindNext do { Do something here } end else ShowMessage('Row was not found'); end; end;
This web page was last updated on Thursday, November 16, 2023 at 10:39 AM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |