Problem with query on XE7
Posted: Sat 30 May 2015 15:18
Why this code work:
But this code doesn't work:
What am i doing wrong? why it won't work?
Code: Select all
procedure TForm1.Edit1KeyUp(Sender: TObject; var Key: Word; Shift: TShiftState);
begin
case RadioGroup1.ItemIndex of
0: UniQuery1.SQL.Text:='Select Name, address, Phone, email, status, uslogin from clients where Name like :text order by name';
1: UniQuery1.SQL.Text:='Select Name, address, Phone, email, status, uslogin from clients where Phone like :text order by name';
2: UniQuery1.SQL.Text:='Select Name, address, Phone, email, status, uslogin from clients where email like :text order by name';
end;
UniQuery1.ParamByName('text').Value:='%'+Edit1.text+'%';
UniQuery1.Execute;
end;
Code: Select all
procedure TForm1.Edit1KeyUp(Sender: TObject; var Key: Word; Shift: TShiftState);
begin
UniQuery1.SQL.Text:='Select Name, address, Phone, email, status, uslogin from clients where :st like :text order by name';
case RadioGroup1.ItemIndex of
0: UniQuery1.ParamByName('st').Value:='Name';
1: UniQuery1.ParamByName('st').Value:='Phone';
2: UniQuery1.ParamByName('st').Value:='email';
end;
UniQuery1.ParamByName('text').Value:='%'+Edit1.text+'%';
UniQuery1.Execute;
end;