Afternoon Team looking for some help regarding looping a stored procedure. My Procedure updates two tables Parent and child and is working fine.
Now in ASP on the click button event it runs and inserts data to both tables as I would like, what I want to do though is have a text box and if the user
say enters the number 3 the stored procedure will run 3 times automatically giving me the 3 entries to the database so to speak I know the data will be the same
but I want the 3 unique numbers it will generate. (PK and FK set to identity) Is there an easy way to loop this process I have tried using a loop but it still only making
one entry into the database so it's not quite right.
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button1.Click
Dim Counter As Integer
Counter = Counter + 1
Loop Until Counter = Convert.ToInt32(TextBox1.Text) -- Number of times I want the procedure to run
Using connection As New SqlConnection(ConfigurationManager.ConnectionStrings("STOCKConnectionString1").ConnectionString)
Dim command As New SqlCommand("dbo.Packtest", connection)
command.CommandType = CommandType.StoredProcedure
View Complete Post