Hi Guys
Am I missing something here I tried a query code from FAQ but I cannot get it to work the problem at present is when it gets to Parambyname it says missing operator or semicolon anybody with any ideas please.
procedure TJobStatus.FormCreate(Sender: TObject);
begin
inherited;
SString:='%%';
cbselect.ItemIndex :=0;
end;
procedure TJobStatus.edtselectChange(Sender: TObject);
begin
inherited;
sstring :='%' + edtselect.text + '%';
end;
procedure TJobStatus.bbtnselectClick(Sender: TObject);
begin
inherited;
with jobstatus do
begin
close;
datamodule2.JobStatus.SQL.clear;
datamodule2.JobStatus.sql.add('Jobno,Customer,ref,notes');
datamodule2.JobStatus.sql.add('from Jobstable Jobstable');
case cbselect.ItemIndex of
0: begin
datamodule2.JobStatus.sql.add ('where jobno like :searchstring');
Parambyname('searchstring').asstring:=sstring;
end;
1: begin
datamodule2.JobStatus.sql.add ('where Customer like :searchstring');
Parambyname('searchstring').asstring:=sstring;
end;
2: begin
datamodule2.JobStatus.sql.add ('where Ref like :searchstring');
Parambyname('searchstring').asstring:=sstring;
end;
3: begin
datamodule2.JobStatus.sql.add ('where notes like :searchstring');
Parambyname('searchstring').asstring:=sstring;
end;
end;
Graham
Am I missing something here I tried a query code from FAQ but I cannot get it to work the problem at present is when it gets to Parambyname it says missing operator or semicolon anybody with any ideas please.
procedure TJobStatus.FormCreate(Sender: TObject);
begin
inherited;
SString:='%%';
cbselect.ItemIndex :=0;
end;
procedure TJobStatus.edtselectChange(Sender: TObject);
begin
inherited;
sstring :='%' + edtselect.text + '%';
end;
procedure TJobStatus.bbtnselectClick(Sender: TObject);
begin
inherited;
with jobstatus do
begin
close;
datamodule2.JobStatus.SQL.clear;
datamodule2.JobStatus.sql.add('Jobno,Customer,ref,notes');
datamodule2.JobStatus.sql.add('from Jobstable Jobstable');
case cbselect.ItemIndex of
0: begin
datamodule2.JobStatus.sql.add ('where jobno like :searchstring');
Parambyname('searchstring').asstring:=sstring;
end;
1: begin
datamodule2.JobStatus.sql.add ('where Customer like :searchstring');
Parambyname('searchstring').asstring:=sstring;
end;
2: begin
datamodule2.JobStatus.sql.add ('where Ref like :searchstring');
Parambyname('searchstring').asstring:=sstring;
end;
3: begin
datamodule2.JobStatus.sql.add ('where notes like :searchstring');
Parambyname('searchstring').asstring:=sstring;
end;
end;
Graham