Hi friends,

I displayed some items on my dropdown list.And users are allowed to select multiple items in the drop box.

After that, If a button is clicked,

I have to execute a single sql code.

Say for eg,
update table_name set flag='y' where field_name='[Dropdown selected items]'

Please help.

Thanx in advance.. :-)

If you want to allow the user to select more than 1 entry I would suggest using a list box control and changing the selection mode property rather than using a combo box because combo boxes should really only be used to select a single value.

You don't actually ask a question you've just stated that you need to update a table but I'm guessing you want to know how to update a table where the value of a record is the same as the name selected?

Do you want to update multiple values at a time?

yes ChrisHunter... I need to pass all the selected values repeatedly until all the selected options are processed inside the query.

Hi ss125 are you still looking for a solution to this problem?

If so can you tell me what type of DB you're using as I only know how to use MS SQL server 2005 onwards.

Can you also show me what code you have done so far please? (I can't just give you the code but I can help you where ever possible).

You need to use in (val1, val2, ...) be warned that this can be a farely slow operation, it's complicated to parameterise and only available in SQL 200 and above.

Edited 3 Years Ago by Ketsuekiame

Thank you @ChrisHunter and @Ketsuekiame.

A few moments ago, I figurred out a solution to pass the selected values to a query.

My problem is to select multiple username from the dropdownlist and on a single click I have to deactivate all the selected users. At first I am out of solution, but later I figured out the solution.

So here is what I did.

I got all the selected username to followed by a delete user sqlcommand inside the loop.. So my goal is acheived... :-D

Comments
That solved my problem too dude.I love you. Thank you.

Good to hear you have found the solution and sorry I was much help to you.

Don't forget to mark the thread as solved and don't hesitate to ask if you have any other questions.

This question has already been answered. Start a new discussion instead.