multiple insert from list box using ASP.NEt
Posted on 2006-03-22
I have a form in which I am using a list box control. I select multiple items from the list box and then I want to insert all those items selected in a table. I am using the following code to do that (which does not work)
For i = 1 To ListBox1.Items.Count
If ListBox1.Items(i - 1).Selected = True Then
'strsub = ListBox1.SelectedItem.Text
Dim cmd As New OleDbCommand("INSERT INTO table1 (promo_sub_brand)VALUES('" & ListBox1.SelectedItem.Text & "')", New OleDbConnection(conn))
it only takes the first item thats selected and then exits. what do I need to do in order to insert multiple items from a list box.