473,408 Members | 1,798 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

Multiple Procedures in ASP.NET

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

Aug 19 '06 #1
2 1227
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

Aug 19 '06 #2
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
Aug 19 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Ed_No_Spam_Please_Weber | last post by:
Hello All & Thanks in advance for your help! Background: 1) tblT_Documents is the primary parent transaction table that has 10 fields and about 250,000 rows 2) There are 9 child tables with...
26
by: pb648174 | last post by:
I have a table called BidItem which has another table called BidAddendum related to it by foreign key. I have another table called BidFolder which is related to both BidItem and BidAddendum, based...
5
by: Stanley Sinclair | last post by:
I have a need to return multiple result sets from a stored procedure. Want that SP to call others to get the data. Win2003, db2 8.1.5. Can't figure out how to handle open cursors, and return...
3
by: Yul | last post by:
Hi, We are in the process of designing an ASP.NET app, where a user will enter some 'Customer ID' to be queried in the database. If the ID is valid, several stored procedures will be called to...
7
by: David Lozzi | last post by:
I need to support multiple keyword search, not boolean searchs, just simple searches, i.e. "marhsall ma". How is this done? Do I send the entire search string to the Proc? How do I deal with it...
15
by: Iced Crow | last post by:
In C# I know that you can use delegates to assing multiple addresses of sub and functions to a delegate and have it fire multiple procedures... How do I do this in VB? I only know of assigning...
5
by: mimo | last post by:
Hello, I have seen samples on how to pull data from one table and save back to it using the Form View control. How do I pull from multiple tables and save back to multiple tables on one...
9
by: TC | last post by:
I need to design a system which represents multiple "projects" in SQL Server. Each project has the same data model, but is independent of all others. My inclination is to use one database to store...
27
by: Smithers | last post by:
Until now I have worked on small teams (1-3 developers) and we've been able to stay out of each others way. Now I'm about to start work on a project that will have 5 developers. I would appreciate...
3
by: Otto Carl Marte | last post by:
Hi, As I understand it, Declared Global Temporary Tables (DGTTs) have a scope that is session/connection based. Using the same connection, I have discovered that if I declare a DGTT in one...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.