Partial Search In Table(BDE)
I made a database with paradox 7. The usual search I开发者_JAVA技巧 do is a syntax like this:
Table.Filter := 'Country=' + QuotedStr(Edit.Text);
This returns rows those country field is same as the entered text in edit. when I want to search for countries are beginning by "L" i use this syntax:
Table.Filter := 'Country=' + QuotedStr(Edit.Text + '*');
But how can I search for fields those are finished with "L"? this syntax does not work:
Table.Filter := 'Country=' + QuotedStr('*' + Edit.Text );
Thanks.
You can use the OnFilterRecord
event to carry out a customized filtering. With your example, maybe sth. like this:
procedure TForm1.Table1FilterRecord(DataSet: TDataSet; var Accept: Boolean);
var
s: string;
begin
Accept := False;
if not DataSet.FieldByName('Country').IsNull then begin
s := DataSet.FieldByName('Country').AsString;
Accept := Copy(s, Length(s), 1) = 'L';
end;
end;
精彩评论