|
Subject:
|
Loops
|
|
Posted By:
|
deontae45
|
Post Date:
|
9/28/2006 3:14:19 PM
|
I'm running a program were the person at the start of the day will check each person's name who is in the office for that day. That person name will be added to a table, to be included in a phone rotation. I'm passing that name through a parameter called strName to run a stored procedure. The program works if I check one person's name at a time and press submit. How Can I check everyone's name at one time and press submit, and it's adds everyone's name to that table? I know I need some kind of a loop.
This is my code: strconnection = New SqlConnection(Application("strConnection")) strName = chkListbox.SelectedItem.Value Dim saveSpecialist As SqlCommand = New SqlCommand ("spSaveCS", strconnection) saveSpecialist.CommandType = CommandType.StoredProcedure strconnection.Open() With saveSpecialist.Parameters .Add("@Name", strName) End With saveSpecialist.ExecuteNonQuery() strconnection.Close
|
|
Reply By:
|
dparsons
|
Reply Date:
|
9/28/2006 3:27:40 PM
|
Ya you need something like this: Dim item as new listitem
for each item in chkListBox.Items if item.selected then strName = item.value //sql code end if next
--Stole this from a moderator
I will only tell you how to do it, not do it for you. Unless, of course, you want to hire me to do work for you.
|
|
Reply By:
|
deontae45
|
Reply Date:
|
9/28/2006 3:48:38 PM
|
Thanks dparsons you are a genius!!!
Alexander Nelson Programmer
|