Link to home
Start Free TrialLog in
Avatar of Mr_Shaw
Mr_Shaw

asked on

listbox mutliselect

Has anybody ever created a Listbox with a multiselect. Then managed to pass the selected item values accross to a stored procedure as OR statements.

For example the selection is 1,2,3 therefore the SQL statement will be 1 or 2 or 3
ASKER CERTIFIED SOLUTION
Avatar of Alpha Au
Alpha Au
Flag of Hong Kong image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
typo... please refer to the following for the select statement
select * from table1 where 
exists(SELECT 1 FROM dbo.fnSplitCommaList(@selectedList,',') where strValue = table1.field1)

Open in new window

Avatar of Dirk Haest
The easiest will be to loop the selecteditems and store it in a string to pass it as a parameter
string selitems = "";
for(int cnt =0;cnt <= listBox1.SelectedItems.Count -1;cnt++)
    {
      selitems  = selitems  + "," + listBox1.SelectedItems[cnt];                          
    }
Avatar of Mr_Shaw
Mr_Shaw

ASKER

thanks