|
-
January 28th, 2011, 03:15 PM
#16
Re: Executing more than one stored procedure at a time
Have SPRun() be the master, and call 3 more, each doing it's own oDR#, and call each one in sequence. Nothing is there BEFORE a form is loaded.
-
January 31st, 2011, 11:10 PM
#17
Re: Executing more than one stored procedure at a time
Assuming that all of the sprocs use the same parameter, would this work:
Code:
Private Sub SPRun()
Dim oCmd2 As New System.Data.SqlClient.SqlCommand
Dim commands as String() = {"sp_opsum", "sp_opintcheck", "sp_opexceptsum" , "sp_empsum", "sp_empexceptsum"}
Try
With oCmd2
.Connection = New System.Data.SqlClient.SqlConnection("Initial Catalog=mdr;Data Source=xxxxx;uid=xxxxx;password=xxxxx")
.Connection.Open()
.CommandType = CommandType.StoredProcedure
.Parameters.AddWithValue("@payperiodstartdate", payperiodstartdate)
.Parameters.AddWithValue("@payperiodenddate", payperiodenddate)
for each strCommand as string in commands
.CommandText = strcommand
.Execute
next
oCmd2.Connection.Close()
End With
Catch ex As Exception
MessageBox.Show(ex.Message)
oCmd2.Connection.Close()
End Try
End Sub
-tg
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|