Author: Jackxxx | Posted on: 2/17/2010 12:30:38 PM | Views : 877

 Here is what I have, but I know there must be a better way. I would like to learn one of those better ways.
Dim cmdInsert As SqlCommand cmdInsert = New SqlCommand cmdInsert.CommandText = "Insert_Interests" cmdInsert.CommandType = CommandType.StoredProcedure cmdInsert.Connection = New SqlConnection(ConnectStr) Dim i As Integer Dim chkbx As CheckBoxList chkbx = chklst15 Try cmdInsert.Connection.Open() For i = 0 To chkbx.Items.Count - 1 If chkbx.Items(i).Selected Then cmdInsert.Parameters.AddWithValue("@ClientID", hfClientID.Value) cmdInsert.Parameters.AddWithValue("@InterestID", chkbx.Items(i).Value) cmdInsert.ExecuteNonQuery() cmdInsert.Parameters.Clear() End If Next Catch ...

Go to the complete details ...