I ran into an issue with the ELB: multi-select list box (thrid part control for ASP.NET which allows for multiple dropdown selections). I have an ELB multi-selectable dropdown, and I want to send selected contents (ie. “Someone, SomeoneElse, ThirdPerson” , etc. as a varchar (say: “@ELB_vals”) parameter to a SQL stored proc that is constructed as follows (simplified for brevity):
SELECT * FROM tblUsers WHERE UserName IN(@ELB_vals)
I thought this would work, but for whatever reason, while sending a single value works, sending the delimited list will not work. I tried replacing all of the commas with ‘,’ which I thought MSSQL would approve of, but no. Does anyone know how I can format the selected values string into something that my sproc will take? (ie. I want the parameter to be 'Someone', 'SomeoneElse', 'ThirdPerson'----> as I said I tried doing this with Replace, however ASP.NET leaves the surrounding double quotes, making it "'Someone', 'SomeoneElse', 'ThirdPerson'", which causes the thing to fail.
Thanks for any help/suggestion in advance,
Colin
exec ('SELECT * FROM tblUsers WHERE UserName IN(' + @ELB_vals+ ')')