S
sean
Hi There,
I am trying to loop through some fields on a form in order to call a stored
procedure to insert bulk information into SQL server, the thing is I am
trying to exit the loop but the loop keeps going past the counter varible. I
only want to insert the information based on the value of the counter, what
am I doing wrong?
Sean
Dim aValues As New ArrayList()
Dim iCount As Integer
Dim counter as Integer
If Page.IsPostBack Then
Dim ctlFormulario, ctlControl As Control
For Each ctlFormulario In Me.Controls
counter += 1
If counter = 5 Then Exit For
response.write (counter = 5)
'If TypeOf (ctlFormulario) Is
System.Web.UI.HtmlControls.HtmlForm Then
If TypeOf (ctlFormulario) Is
System.Web.UI.WebControls.TextBox Then
'For Each ctlControl In ctlFormulario.Controls
For Each ctlControl In ME.Controls
If TypeOf (ctlControl) Is TextBox AND counter <> 5
Then
aValues.Add(CType(ctlControl, TextBox).Text)
' response.write (CType(ctlControl, TextBox).ID & "<BR>")
Response.Write(" " & aValues(iCount) & "<BR>")
iCount += 1
Stored procedure call
End If
Next
End If
Next
End If
I am trying to loop through some fields on a form in order to call a stored
procedure to insert bulk information into SQL server, the thing is I am
trying to exit the loop but the loop keeps going past the counter varible. I
only want to insert the information based on the value of the counter, what
am I doing wrong?
Sean
Dim aValues As New ArrayList()
Dim iCount As Integer
Dim counter as Integer
If Page.IsPostBack Then
Dim ctlFormulario, ctlControl As Control
For Each ctlFormulario In Me.Controls
counter += 1
If counter = 5 Then Exit For
response.write (counter = 5)
'If TypeOf (ctlFormulario) Is
System.Web.UI.HtmlControls.HtmlForm Then
If TypeOf (ctlFormulario) Is
System.Web.UI.WebControls.TextBox Then
'For Each ctlControl In ctlFormulario.Controls
For Each ctlControl In ME.Controls
If TypeOf (ctlControl) Is TextBox AND counter <> 5
Then
aValues.Add(CType(ctlControl, TextBox).Text)
' response.write (CType(ctlControl, TextBox).ID & "<BR>")
Response.Write(" " & aValues(iCount) & "<BR>")
iCount += 1
Stored procedure call
End If
Next
End If
Next
End If