Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > How can I use a multiselect listbox to pass parameter to a SQL SP

Reply
Thread Tools

How can I use a multiselect listbox to pass parameter to a SQL SP

 
 
Jeff Thur
Guest
Posts: n/a
 
      02-14-2005
I have a program where the user does database lookups. I
need to have a listbox where thue user can select one or
more states and a regular textbox to select a last name.
I am not sure how I can do this. I figure that the
programmer must build the criteria from the listbox
itself. Any ideas on how to pass the multiple selections
to a SQL Stored Procedure. The Textbox part is no
problem. Thanks for any help.
 
Reply With Quote
 
 
 
 
Riki
Guest
Posts: n/a
 
      02-14-2005
Jeff Thur wrote:
> I have a program where the user does database lookups. I
> need to have a listbox where thue user can select one or
> more states and a regular textbox to select a last name.
> I am not sure how I can do this. I figure that the
> programmer must build the criteria from the listbox
> itself. Any ideas on how to pass the multiple selections
> to a SQL Stored Procedure. The Textbox part is no
> problem. Thanks for any help.


First concatenate the values into a string, separated by commas.
Pass this string to your sproc.

Then, in your SQL command, use the IN operator like this:
.... WHERE myField IN (@values) ...

--

Riki


 
Reply With Quote
 
 
 
 
Kostadin Kostov
Guest
Posts: n/a
 
      02-14-2005
Use dataset, and DataAdapter that populates the changes in your dataset to
the database using your stored procedure.

Hope that helps!
Regards,
Kostadin Kostov

"Jeff Thur" wrote:

> I have a program where the user does database lookups. I
> need to have a listbox where thue user can select one or
> more states and a regular textbox to select a last name.
> I am not sure how I can do this. I figure that the
> programmer must build the criteria from the listbox
> itself. Any ideas on how to pass the multiple selections
> to a SQL Stored Procedure. The Textbox part is no
> problem. Thanks for any help.
>

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
Listbox Multiselect as filter for Gridview Nick Nelson ASP .Net Web Controls 8 08-24-2009 03:22 PM
ObjectDataSource / MultiSelect ListBox Jay Pondy ASP .Net Web Controls 1 09-22-2007 06:18 PM
Unexpected behaviour of Listbox MultiSelect Martin ASP .Net Web Controls 5 01-24-2006 08:15 AM
Multiselect listbox jumps to top on postback Lenard Gunda ASP .Net 3 08-17-2005 04:29 PM



Advertisments