這是決賽,但已經adoquery過濾器無法過濾
任何人有關於我的過濾問題德爾福與列表框項目
begin
adoquery1.SQL.CLEAR;
adoquery1.SQL.Add('select * FROM gunsonu ');
adoquery1.SQL.Add('where TARIH like :TRH');
adoquery1.Parameters.ParamByName('TRH').Value:=(PlannerDatePicker1.text);
for i := 0 to form3.ListBox1.Items.Count-1 do
adoquery1.SQL.Add(' and VLIM <> '+QuotedStr(form3.ListBox1.items[i]));
end;
adoquery1.Open;
frxReport1.ShowReport(true);
當你說'不能'你的意思是你的代碼執行,但adoquery1不返回任何行?最類似的原因是您的列表框項不包含任何'%'通配符。如果沒有,它就像你有'='符號而不是'like'一樣工作。 – MartynA
此外,如果您試圖匹配列表框項目的列是字符列,你應該圍繞「form3.ListBox1.items [i]」由「QuotedStr()」 – MartynA
我嘗試喜歡它,但它已經過濾器是空的: ( 開始 adoquery1.SQL.CLEAR; adoquery1.SQL.Add( 'SELECT * FROM gunsonu '); adoquery1.SQL.Add(' 其中TARIH像:TRH'); adoquery1.Parameters.ParamByName( 'TRH')值:=(PlannerDatePicker1.text); 對於i:= 0至form3.ListBox1.Items.Count-1做 adoquery1.SQL.Add( '和VLIM =' + QuotedStr(form3。ListBox1.items [I])); 結束; adoquery1.Open; frxReport1.ShowReport(true); 結束; –