Loops
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
__________________
Alexander Nelson
Programmer
|