I got a problem with Delphi.
I have to compare a string of 4 char, with data in database which is 6 char long (postal code(netherlands)).
What I have now is:
procedure Tfmpostcode.Button1Click(Sender: TObject);
var
postcode : string;
target: string;
begin
postcode := ePostcode.text;
target := leftStr(postcode,4);
dm.atinlog.filter := 'postcode =' + (target);
dm.atinlog.filtered := true;
dbgrid1.visible := true;
end;
I have been searching the net, and I found you could use ansistring. but it gives an error.
missing operator or semicolon
What should I do?
I updated the code
Additional info:
I need to compare a part of the string with data in database
If i enter 5504BX in edit field
the dbgrid should show up with
5504LA
5504KJ
all that starts with the first 4 numbers. the letters doesnt matter.
I think you need to quote the string. Use QuotedStr.
If you need a wild-card match you can do