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.
Printable View
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.
Assuming that all of the sprocs use the same parameter, would this work:
-tgCode: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