Listbox database insert

  • Thread starter Thread starter Big E
  • Start date Start date
B

Big E

I'm using ASP.Net and SQL Server 2000.
I have a Listbox that users can select multiple values. Selection Mode =
Multiple.
The multiple values are associated with one record. I need to insert into
the database like this:

Erik San Diego
Erik San Francisco
Erik Sacramento

How can I find out what the selection value is if they picked more than one.

Thanks.

Big E
 
dim i as integer

for i = 1 to listbox1.items.count
if listbox1.items(i-1).selected = true then
do stuff
end if
next
 
How would I use this with a stored procedure that has parameters? Where
would I stick this?

Thanks.

Big E
MyCommand.SelectCommand.Parameters.Add(New SqlParameter("@QuestionId",
SqlDbType.Int))

MyCommand.SelectCommand.Parameters("@QuestionId").Value = txtQuestionId.Text
 
Back
Top