【发布时间】:2011-05-15 06:48:18
【问题描述】:
尊敬的专家, 我正在尝试过滤连接到 adoquery 的 dbgrid 中的结果,根据用户选择的 4 个复选框,用户可以选择一个或多个文件来相应地过滤数据 我有这段代码,如果用户选择两个或更多复选框,我不知道如何传递“和/或不传递”它。
Vw_Activity.SQL.Text:='select * from Vw_Activity where ';
if CBEmployee.Checked then
begin
Vw_Activity.SQL.Add('Emp_Name_Ar=:x');
Vw_Activity.Parameters.ParamByName('x').Value:=emp Name.Text;
end;
if CBTask.Checked then
begin
Vw_Activity.SQL.Add('Category_Name=:y');
Vw_Activity.Parameters.ParamByName('y').Value:=Pro blemCat.Text;
end;
if CBIncharge.Checked then
begin
Vw_Activity.SQL.Add('Support_name_En=:h');
Vw_Activity.Parameters.ParamByName('h').Value:=Sup portstaff.Text;
end;
if CBstatus.Checked then
begin
Vw_Activity.SQL.Add('Request_Status=:k');
Vw_Activity.Parameters.ParamByName('k').Value:=Req uestStatus.Text;
end;
Vw_Activity.Active:=true;
等待你的帮助
【问题讨论】:
标签: delphi ado parameter-passing