Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: adoquery filter with listbox items



Permlink Replies: 1 - Last Post: Oct 14, 2015 5:56 AM Last Post By: Robert Triest
Ferhat Ergin Tu...

Posts: 16
Registered: 7/17/15
adoquery filter with listbox items
Click to report abuse...   Click to reply to this thread Reply
  Posted: Oct 13, 2015 10:59 PM
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 like '+ form3.ListBox1.items[i]);
adoquery1.Open;
end;

it is not filtered my data :( is there anyone to help :)

Robert Triest

Posts: 687
Registered: 3/24/05
Re: adoquery filter with listbox items
Click to report abuse...   Click to reply to this thread Reply
  Posted: Oct 14, 2015 5:53 AM   in response to: Ferhat Ergin Tu... in response to: Ferhat Ergin Tu...
for i := 0 to form3.ListBox1.Items.Count-1 do
adoquery1.SQL.Add(' and VLIM like '+ form3.ListBox1.items[i]);
this is the same as:
adoquery1.SQL.Add(' and VLIM = '+ form3.ListBox1.items[i]);

Do you want:
strLike:=QuotedStr('%'+ form3.ListBox1.items[i]+'%');
adoquery1.SQL.Add(' AND VLIM like strLike);
(be sure you don't need OR)

it is not filtered my data :( is there anyone to help :)
What do you mean by "not filtered my data"?
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02