nntp2http.com
Posting
Suche
Optionen
Hilfe & Kontakt

DataSet avanced data filtering

Von: GD (euthymos@gmail.com) [Profil]
Datum: 13.02.2007 10:35
Message-ID: <1171359338.870990.281340@m58g2000cwm.googlegroups.com>
Newsgroup: alt.comp.lang.borland-delphi
Dear developers,

I'm trying to implement an "instant search field" for a DataSet.


This is the code of the TEdit.OnChange event handler:

procedure TForm1.editSurnameSearchChange(Sender : TObject);
begin
if Trim(TEdit(Sender).Text) <> '' then
begin
DataSetStudents.Filtered := False;
DataSetStudents.Filter := 'Surname LIKE ' +
QuotedStr(Trim(TEdit(Sender).Text) + '%');
DataSetStudents.Filtered := True;
end
else
DataSetStudents.Filtered := False;
end;


What I'm trying to do is to filter the dataset so that only the
records whose "Surname" field STARTS WITH a certain string are
displayed.


But, it simply doesn't work that way... The syntax 'Surname LIKE ' +
QuotedStr(Trim(TEdit(Sender).Text) + '%') is not accepted. What can I
do?


Thank you in advance. :)


[ Auf dieses Posting antworten ]

Antworten