Visual Studio .NET - To insert multiple values in a column of the database selected from the listbox

Asked By Nikhal Sood on 07-Mar-07 04:29 PM

In a form i have a several textboxes and a listbox with multiple items.I changed the Selection Property of the listbox to 'Multiple'. Now if user enters values in the textbox and selects multiple values in this listbox ,i need to enter the valus in the databse table with the insert query.

I am able to insert only one value of the listbox not the multiple in the column. How can i add multiple values int he column with comma separated.

Multiple ListBox selections

Peter Bromberg replied to Nikhal Sood on 07-Mar-07 04:54 PM

are transmitted as Request.Form["ListboxId"] and they are comma-delimited.

So depending on how you do your insert, you can parse the values out by using the Split method of the String class.