Multiple Procedures in ASP.NET

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
 
G

Guest

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,822
Latest member
israfaceZa

Latest Threads

Top