Multiple Procedures in ASP.NET

  • Thread starter Thread starter Charles
  • Start date Start date
C

Charles

I have a Web application in VB.Net that has four seperate procdedures
which need to run in order.
Try
cnDownload.Open()
Dim cmdDeleteDownload As New
SqlCommand("ProcDeleteDownload", cnDownload)
cmdDeleteDownload.CommandType = CommandType.StoredProcedure
cmdDeleteDownload.ExecuteNonQuery()
Catch ex As Exception
sendMessage("Issue with running procDeleteDownload")
cnDownload.Close()
Exit Sub
End Try
Try
Dim cmdDownload As New SqlCommand("ProcImportDownLoad",
cnDownload)
With cmdDownload
.CommandType = CommandType.StoredProcedure
End With
Dim drDownload As SqlDataReader
cmdDownload.ExecuteNonQuery()
Catch ex As SystemException
sendMessage("Issue with running procImport")
cnDownload.Close()
Exit Sub
End Try
Try
Dim cmdInsertMembers As New
SqlCommand("ProcInsertNewDownload", cnDownload)
With cmdinsertmembers
.CommandType = CommandType.StoredProcedure
End With
Dim drInsert As SqlDataReader
cmdInsertMembers.ExecuteNonQuery()
Catch ex As Exception
sendMessage("Issue with running procInsertNewDownload")
cnDownload.Close()
Exit Sub
End Try
Try
Dim cmdInsertMembers As New SqlCommand("ProcAddMembers",
cnDownload)
cmdInsertMembers.CommandType = CommandType.StoredProcedure
cmdInsertMembers.ExecuteNonQuery()
Catch ex As Exception
sendMessage("Issue with running procAddMembers")
cnDownload.Close()
Exit Sub
End Try

Running in debug works fine but not in final release. Do I need to
handle these statements so the code waits for each procedure to finish
before proceding?

Thanks
Charles
 
No, because from your code sample they all appear to be blocking calls
(nothing goes forward until the call returns).
However, you could make it a bit more robust:

1) get the return value from your cmdXXX methods and do something useful
with it.
2) you are catching exceptions but you aren't even using them, send back the
exception Message and StackTrace in your SendMessage so you can really find
out what's happening.
Peter
 
Back
Top