473,382 Members | 1,791 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,382 software developers and data experts.

Multiple Stored Procedure Calls within single transaction

I am using SQL 2000 and VB.NET (VS 2005).

I have three stored procedure: sp_A, sp_B and sp_C

I need to be able to call sp_A once and sp_B and sp_C 1 to n number of
times all within a single transaction that can be rolled back if any
of the calls to the stored procedures fail.

sp_A - inserts to table ZZZ
sp_B - inserts to table YYY (but needs to be called multiple times)
and is dependent on the primary key being inserted into table ZZZ that
sp_A is inserting into.
sp_C inserts to table QQQ (but needs to be called multiple times) and
is dependent on the primary key being inserted into table ZZZ that
sp_A is inserting into.

I would prefer to use Enterprise Library 3 for my database calls.
Nov 28 '07 #1
6 8002
On Nov 28, 12:52 pm, BostonNole <bostonn...@gmail.comwrote:
I am using SQL 2000 and VB.NET (VS 2005).

I have three stored procedure: sp_A, sp_B and sp_C

I need to be able to call sp_A once and sp_B and sp_C 1 to n number of
times all within a single transaction that can be rolled back if any
of the calls to the stored procedures fail.

sp_A - inserts to table ZZZ
sp_B - inserts to table YYY (but needs to be called multiple times)
and is dependent on the primary key being inserted into table ZZZ that
sp_A is inserting into.
sp_C inserts to table QQQ (but needs to be called multiple times) and
is dependent on the primary key being inserted into table ZZZ that
sp_A is inserting into.

I would prefer to use Enterprise Library 3 for my database calls.
Are you expecting someone to write the code for you?

I do not know what Enterprise Library 3 is, but it's easy to do what
you want with ADO.NET. Check out:

https://msdn2.microsoft.com/en-us/li...on(VS.71).aspx
Nov 28 '07 #2
On Nov 28, 2:05 pm, za...@construction-imaging.com wrote:
On Nov 28, 12:52 pm, BostonNole <bostonn...@gmail.comwrote:


I am using SQL 2000 and VB.NET (VS 2005).
I have three stored procedure: sp_A, sp_B and sp_C
I need to be able to call sp_A once and sp_B and sp_C 1 to n number of
times all within a single transaction that can be rolled back if any
of the calls to the stored procedures fail.
sp_A - inserts to table ZZZ
sp_B - inserts to table YYY (but needs to be called multiple times)
and is dependent on the primary key being inserted into table ZZZ that
sp_A is inserting into.
sp_C inserts to table QQQ (but needs to be called multiple times) and
is dependent on the primary key being inserted into table ZZZ that
sp_A is inserting into.
I would prefer to use Enterprise Library 3 for my database calls.

Are you expecting someone to write the code for you?

I do not know what Enterprise Library 3 is, but it's easy to do what
you want with ADO.NET. Check out:

https://msdn2.microsoft.com/en-us/li...odbctransa...- Hide quoted text -

- Show quoted text -
I am not asking anyone to write any code for me. Your link is for an
ODBC class that is for .NET 1.1 only. I am using .NET 2.0.
Nov 28 '07 #3
BostonNole <bo********@gmail.comwrote in news:9fd85aa9-1a88-4a0a-8e1a-
81**********@w34g2000hsg.googlegroups.com:
I am not asking anyone to write any code for me. Your link is for an
ODBC class that is for .NET 1.1 only. I am using .NET 2.0.
ODBC class is part of the .NET 2.0 framework too.

AFAIK, you can't wrap multiple SPs in a transaction. Each SP has it's own
execution context. But I could be wrong.
Nov 28 '07 #4
On Wed, 28 Nov 2007 12:01:18 -0800 (PST), BostonNole
<bo********@gmail.comwrote:
>On Nov 28, 2:05 pm, za...@construction-imaging.com wrote:
>On Nov 28, 12:52 pm, BostonNole <bostonn...@gmail.comwrote:


I am using SQL 2000 and VB.NET (VS 2005).
I have three stored procedure: sp_A, sp_B and sp_C
I need to be able to call sp_A once and sp_B and sp_C 1 to n number of
times all within a single transaction that can be rolled back if any
of the calls to the stored procedures fail.
sp_A - inserts to table ZZZ
sp_B - inserts to table YYY (but needs to be called multiple times)
and is dependent on the primary key being inserted into table ZZZ that
sp_A is inserting into.
sp_C inserts to table QQQ (but needs to be called multiple times) and
is dependent on the primary key being inserted into table ZZZ that
sp_A is inserting into.
I would prefer to use Enterprise Library 3 for my database calls.

Are you expecting someone to write the code for you?

I do not know what Enterprise Library 3 is, but it's easy to do what
you want with ADO.NET. Check out:

https://msdn2.microsoft.com/en-us/li...odbctransa...- Hide quoted text -

- Show quoted text -

I am not asking anyone to write any code for me. Your link is for an
ODBC class that is for .NET 1.1 only. I am using .NET 2.0.
For native SqlServer the equivalent object is:

<http://msdn2.microsoft.com/en-us/library/system.data.sqlclient.sqltransaction.aspx>

I have never used Enterprise Library, but Googling for "Enterprise
Library 3 transactions" has some links that might be helpful.

Nov 28 '07 #5
On Nov 28, 11:52 am, BostonNole <bostonn...@gmail.comwrote:
I am using SQL 2000 and VB.NET (VS 2005).

I have three stored procedure: sp_A, sp_B and sp_C

I need to be able to call sp_A once and sp_B and sp_C 1 to n number of
times all within a single transaction that can be rolled back if any
of the calls to the stored procedures fail.

sp_A - inserts to table ZZZ
sp_B - inserts to table YYY (but needs to be called multiple times)
and is dependent on the primary key being inserted into table ZZZ that
sp_A is inserting into.
sp_C inserts to table QQQ (but needs to be called multiple times) and
is dependent on the primary key being inserted into table ZZZ that
sp_A is inserting into.

I would prefer to use Enterprise Library 3 for my database calls.
If you have your Enterprise Library Database object, you can
call .CreateConnection method to get the connection. Then with the
connection instance, you can call BeginTransaction.

Then for each stored proc you need to call, pass that transaction in
when you call the various ExecuteReader, ExecuteNonQuery, etc.
methods.

Then afterwards, assuming everything went ok, call the Commit method
on the transaction object.

HTH

Chris
Nov 28 '07 #6
On Nov 28, 5:19 pm, Chris Dunaway <dunaw...@gmail.comwrote:
On Nov 28, 11:52 am, BostonNole <bostonn...@gmail.comwrote:


I am using SQL 2000 and VB.NET (VS 2005).
I have three stored procedure: sp_A, sp_B and sp_C
I need to be able to call sp_A once and sp_B and sp_C 1 to n number of
times all within a single transaction that can be rolled back if any
of the calls to the stored procedures fail.
sp_A - inserts to table ZZZ
sp_B - inserts to table YYY (but needs to be called multiple times)
and is dependent on the primary key being inserted into table ZZZ that
sp_A is inserting into.
sp_C inserts to table QQQ (but needs to be called multiple times) and
is dependent on the primary key being inserted into table ZZZ that
sp_A is inserting into.
I would prefer to use Enterprise Library 3 for my database calls.

If you have your Enterprise Library Database object, you can
call .CreateConnection method to get the connection. Then with the
connection instance, you can call BeginTransaction.

Then for each stored proc you need to call, pass that transaction in
when you call the various ExecuteReader, ExecuteNonQuery, etc.
methods.

Then afterwards, assuming everything went ok, call the Commit method
on the transaction object.

HTH

Chris- Hide quoted text -

- Show quoted text -
Thank you Chris, I think this is exactly what I was looking for.
Nov 29 '07 #7

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

Similar topics

4
by: Mike | last post by:
Hello, I'm currently working on debugging a very large DTS package that was created by someone else for the purpose of importing data into my company's database. The data is mainly...
11
by: harborboy76 | last post by:
Hi, I have a stored procedure that does a lot of INSERT/UDATE to 3 tables. And When I call the stored procedure, I get a Transaction Log Full error. When I want to do is turning off the...
0
by: usenet | last post by:
Hi. I have a DB2 stored procedure that I call using JDBC. Now I'm trying to batch the call. This is done by the book: stmt = connection.prepareCall(" ... "); stmt.setString(1, "foo");...
3
by: Irfan | last post by:
There are several ways of handling Transactions in DotNet. Some of them are 1. Using COM+ Serviced Component. 2. Using ADO .Net 3. using stored procedure What is the best way of handling...
9
by: ucasesoftware | last post by:
i need to use this : Private Shared Sub Demo1() Dim db As SqlConnection = New SqlConnection("connstringhere") Dim transaction As SqlTransaction db.Open transaction = db.BeginTransaction Try...
9
by: Mark A | last post by:
Quoted from the: "Application Development Guide: Programming Server Applications Version 8.2": (DB2 for LUW). "Stored procedures cannot issue COMMIT or ROLLBACK statements if the stored...
1
by: amgupta8 | last post by:
Note: This problem occurred when I updated the JDK from 1.3.1 to 1.4.1 or 1.4.2. Nothing else was changed in the code, other than updating the JDK on the database server (dbm cfg parm jdk_path) and...
0
by: svgeorge | last post by:
I want to update several tables using one stored procedure. How can i do this I mean the syntax.etc. declaration etc. I know the basic syntax as below CREATE PROCEDURE <Procedure_Name, sysname,...
1
by: psycho | last post by:
How do we return a single value from a stored procedure. Suppose I have a stored procedure like this: create proc dbo.spInsertGroup @ID uniqueidentifier @GroupName varchar(100), @IsActive...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel

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.