Link to home
Start Free TrialLog in
Avatar of danz67
danz67Flag for Italy

asked on

DELPHI 7 - Query

I get the records that contain different parameters, the problem is parameter: STATO I need to search for all records containing the parameter: STATO with value 'RIENTRATO and RIPARATO, I tried with this code, but I get no records displayed
with DataModule2.QAssistenze do
  begin
  SQL.Text :=
    'select * from riparazioni where cliente = :cliente  '+
       'and StatoAssistenza like :stato '+
       'and accettazioneanno = :anno';
     Params.ParamByName('CLIENTE').AsString := combocliente.EditingText;
     Params.ParamByName('STATO').AsString := '%' + 'RIENTRATO RIPARATO' + '%';
     Params.ParamByName('ANNO').AsString := comboanno.Text;
     open;
  end;

Open in new window

Avatar of twinsoft
twinsoft
Flag of Greece image

Hi, try it like this

with DataModule2.QAssistenze do
  begin
  SQL.Text :=
    'select * from riparazioni where cliente = :cliente  '+
       'and StatoAssistenza like :stato '+
       'and accettazioneanno = :anno';
     Params.ParamByName('CLIENTE').AsString := QuotedStr(combocliente.EditingText);
     Params.ParamByName('STATO').AsString := QuotedStr('%' + 'RIENTRATO RIPARATO' + '%');
     Params.ParamByName('ANNO').AsString := QuotedStr(comboanno.Text);
     open;
  end;
ASKER CERTIFIED SOLUTION
Avatar of Emmanuel PASQUIER
Emmanuel PASQUIER
Flag of France image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of danz67

ASKER

This code works perfectly, thanks