Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Multiple Procedures in ASP.NET

Reply
Thread Tools

Multiple Procedures in ASP.NET

 
 
Charles
Guest
Posts: n/a
 
      08-19-2006
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

 
Reply With Quote
 
 
 
 
=?Utf-8?B?UGV0ZXIgQnJvbWJlcmcgW0MjIE1WUF0=?=
Guest
Posts: n/a
 
      08-19-2006
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

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com




"Charles" wrote:

> 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
>
>

 
Reply With Quote
 
 
 
 
Charles
Guest
Posts: n/a
 
      08-19-2006
Peter,

Thanks! I will modify my exception handling as you suggested.

Charles

Peter wrote:
> 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
>
> --
> Co-founder, Eggheadcafe.com developer portal:
> http://www.eggheadcafe.com
> UnBlog:
> http://petesbloggerama.blogspot.com
>
>
>
>
> "Charles" wrote:
>
> > 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
> >
> >


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to call multiple stored procedures in one db trip? Author #1 ASP .Net 2 04-25-2009 01:55 AM
Looking for Ideas - multiple long running stored procedures Elmo Watson ASP .Net 4 07-24-2007 07:34 PM
Debugging SQL Server 2000 Stored Procedures. lhak ASP .Net 1 10-23-2004 03:30 PM
Putting stored procedures in a dll Soumitra Banerjee ASP .Net 1 02-27-2004 01:46 AM
VB.NET Retrieving Identity form MSSQL2000 without using stored procedures Taras ASP .Net 2 10-05-2003 05:35 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57