Listbox database insert

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
 
S

Steve Caliendo

dim i as integer

for i = 1 to listbox1.items.count
if listbox1.items(i-1).selected = true then
do stuff
end if
next
 
B

Big E

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top