473,699 Members | 2,380 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Scope of transaction processing wrapper

I have some unbound forms that I want to use transaction wrappers on when
updating the table. My question is on the scope of what transaction
processing will do. I'm going to keep it simple with the following code:
Code:
------------------------------------------------------------------------------
--

ws.BeginTrans
bInTrans = True

'Delete record from TableA
rs.Delete

'Now update TableB
Call WriteMasterTabl eRecord(Recordt oDelete, ValueA, ValueB)

'Now update some information in TableC
Call StatusAsMaster( MasterID, ValueD)

ws.CommitTrans
bInTrans = False
------------------------------------------------------------------------------
--
Again, the code has been simplified.

What I want to know is if the transaction wrapper for TableA also covers
TableB and TableC which are updated in other procedures. In my exit handler
there is the following:

If bInTrans = True Then
ws.Rollback
End If

So, if an error occurs, the Error_Handler is invoked and then the exit
handler. Will the Rollback statement roll back the changes to all three
tables (A, B and C) or will it only roll back Table A??

--
Message posted via http://www.accessmonster.com
Mar 13 '06 #1
3 2712
The answer to your question depends on how you write the changes to the
other tables.

If you write the changes with something like:
db.Execute ...
where db is the database in the ws workspace, then they will rollback.

But they will not roll back if you make the changes with (say) RunSQL, or
through another Workspace variable, since these are outside of the scope of
your transaction.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"rdemyan via AccessMonster.c om" <u6836@uwe> wrote in message
news:5d2e8b9dbc 994@uwe...
I have some unbound forms that I want to use transaction wrappers on when
updating the table. My question is on the scope of what transaction
processing will do. I'm going to keep it simple with the following code:
Code:
------------------------------------------------------------------------------
--

ws.BeginTrans
bInTrans = True

'Delete record from TableA
rs.Delete

'Now update TableB
Call WriteMasterTabl eRecord(Recordt oDelete, ValueA, ValueB)

'Now update some information in TableC
Call StatusAsMaster( MasterID, ValueD)

ws.CommitTrans
bInTrans = False
------------------------------------------------------------------------------
--
Again, the code has been simplified.

What I want to know is if the transaction wrapper for TableA also covers
TableB and TableC which are updated in other procedures. In my exit
handler
there is the following:

If bInTrans = True Then
ws.Rollback
End If

So, if an error occurs, the Error_Handler is invoked and then the exit
handler. Will the Rollback statement roll back the changes to all three
tables (A, B and C) or will it only roll back Table A??

Mar 13 '06 #2
Allen:

Thank you for the response. I'm using different DAO workspace, database and
recordset variables in the procedures that update Tables B and C. I'm not
using db.Execute type statements, but instead rsXXX.AddNew or rsXXX.Edit and
rsXXX.Update.

Does this mean that I should pass the DAO variables that update TableA into
the procedures that update TablesB and C. Do I just pass in the ws and db
variables and then create a new recordset based on the SQL statement that is
appropriate for each procedure to accomplish that procedure's job?

If so, I assume that these DAO variables should still be closed in the
original module that created them (i.e. where TableA is updated).

Thanks.

Allen Browne wrote:
The answer to your question depends on how you write the changes to the
other tables.

If you write the changes with something like:
db.Execute ...
where db is the database in the ws workspace, then they will rollback.

But they will not roll back if you make the changes with (say) RunSQL, or
through another Workspace variable, since these are outside of the scope of
your transaction.
I have some unbound forms that I want to use transaction wrappers on when
updating the table. My question is on the scope of what transaction

[quoted text clipped - 35 lines]
handler. Will the Rollback statement roll back the changes to all three
tables (A, B and C) or will it only roll back Table A??


--
Message posted via AccessMonster.c om
http://www.accessmonster.com/Uwe/For...ccess/200603/1
Mar 13 '06 #3
Yes, that all sounds right.

Just pass the Database variable, and it will all rollback.

This article illustrates transactions:
http://allenbrowne.com/ser-37.html
It all happens in one procedure, so it does not illustrate passing the db,
but the technique is identical, and it does explain a couple of traps.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"rdemyan via AccessMonster.c om" <u6836@uwe> wrote in message
news:5d32b3ce99 067@uwe...
Allen:

Thank you for the response. I'm using different DAO workspace, database
and
recordset variables in the procedures that update Tables B and C. I'm not
using db.Execute type statements, but instead rsXXX.AddNew or rsXXX.Edit
and
rsXXX.Update.

Does this mean that I should pass the DAO variables that update TableA
into
the procedures that update TablesB and C. Do I just pass in the ws and db
variables and then create a new recordset based on the SQL statement that
is
appropriate for each procedure to accomplish that procedure's job?

If so, I assume that these DAO variables should still be closed in the
original module that created them (i.e. where TableA is updated).

Thanks.

Allen Browne wrote:
The answer to your question depends on how you write the changes to the
other tables.

If you write the changes with something like:
db.Execute ...
where db is the database in the ws workspace, then they will rollback.

But they will not roll back if you make the changes with (say) RunSQL, or
through another Workspace variable, since these are outside of the scope
of
your transaction.
I have some unbound forms that I want to use transaction wrappers on when
updating the table. My question is on the scope of what transaction

[quoted text clipped - 35 lines]
handler. Will the Rollback statement roll back the changes to all three
tables (A, B and C) or will it only roll back Table A??


--
Message posted via AccessMonster.c om
http://www.accessmonster.com/Uwe/For...ccess/200603/1

Mar 13 '06 #4

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

Similar topics

2
9360
by: Tim Callaghan | last post by:
We have an inhouse replication process which is causing us headaches when we try to run more than one copy of it against the same target database (we support unlimited remote databases so we may have to process in 20 replication files on a Monday morning). The issue I'm seeing is that computer 1 starts processing in the inserts/updates and continues through the process. Computer 2 starts processing inserts/updates fine as well but at...
0
1823
by: Manoj Sharma | last post by:
I am performance testing some batch processing engines. These are written in ..NET and SQL Server and are typically concerned with generating XML files out of data retrieved from the database. I have two machines one running IIS Server and the other SQL Server. Problem Description: One of the engines is failing with the following exception:
15
9994
by: Zeng | last post by:
Hi, The bigger my C# web-application gets, the more places I need to put in the tedious retrying block of code to make sure operations that can run into database deadlocks are re-run (retried) 3-4 times and give up if after that it's still in deadlock. I'm very sure that many experienced people out there already deal with this issue somehow. Is there an alternative to it? Thanks for your comments and suggestions.
0
1077
by: LBS | last post by:
Hello guys I'm trying to implement a wrapper class, and I'm havinf difficulty implementing the transaction. I have several classes. The wrapper WrapDbCommand, WrapConnection..etc, and the actual SQL server class. The connection, parameter,executes works fine. However, When I tries to create a transaction, my property always return
5
7394
by: Allan Ebdrup | last post by:
I'm using dotNet 2.0 and System.Transactions to run transactions that span multiple database queries, Now I would like to log any Sql errors that occur in the transaction, but when I insert the logentry into the database the query that does the inserting is automatically enlisted in the running transaction and rolled back when the transaction aborts. How do I run the query inserting into the log outside the current transaction, so that it...
3
2040
by: GaryDean | last post by:
I'm using TransactionScope as follows... using TransactionScope myScope = new TransactionScope()) { using (SqlConnection conn = new SqlConnection()) { conn.ConnectionString = GlobalData.connString; conn.Open(); ...................code that does db work myScope.Complete();
1
15061
ADezii
by: ADezii | last post by:
Transaction Processing is a Database term that refers to the process of grouping changes to your data into a batch that is treated as a single, atomic unit. Either the entire batch of transactions succeeds, or they all fail. A typical illustration of a Transaction is the transferring of data from one account to another in a banking application. You wouldn’t want your originating account debited a specific amount, have an error occur, and not...
0
17531
ADezii
by: ADezii | last post by:
In the Tip of the Week #19, we demonstrated Transaction Processing, specifically as it applies to DAO (Data Access Objects). In this week's Tip, we'll illustrate how Transaction Processing can be used within the context of ADO (ActiveX Data Objects). Please refer to the Link below if you wish to see an Overview of Transaction Processing, how it is implemented within DAO, or special issues to be aware of when utilizing Transaction Processing in...
0
1545
by: =?Utf-8?B?Sm9l?= | last post by:
Very weird; I lost a day worth of work because of this problem. I have an ASP.NET application written in VB that is using MySQL database. Shortly, a page creates a Customer record in the database and if successful, creates a directory on the web server. I was using Transaction Scope to accomplish this action; here is the code excerpt: ' Initialize the return value to zero Dim returnValue As Integer = 0
0
8689
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9178
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
7752
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6534
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5875
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4376
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3058
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2348
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2010
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.