我想通过设置ADOTable的过滤条件组合来进行查询,可老出错!
代码如下:
if CK_date.Checked then
FilterStr:='bill_date='''+i_start_date.Text+'''';
if CK_car.Checked then
begin
if length(FilterStr)>0 then
FilterStr:=FilterStr+' and ';
FilterStr:=FilterStr+'car_id='''+i_search_car.Text+'''';
end;
代码如下:
if CK_date.Checked then
FilterStr:='bill_date='''+i_start_date.Text+'''';
if CK_car.Checked then
begin
if length(FilterStr)>0 then
FilterStr:=FilterStr+' and ';
FilterStr:=FilterStr+'car_id='''+i_search_car.Text+'''';
end;
FilterStr:='bill_date='''+i_start_date.Text+'''';
类型是否正确? bill_date的类型是否是string?????
FilterStr:='bill_date='''+i_start_date.Text+''' and '
+'car_id='''+i_search_car.Text+''' ';
end;
为什么不这样写你的代码?
出错是不是因为:bill_date='''+i_start_date.Text+'''的类型有问题?
该字段是日期型的吧!^_^