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

Transaction Directive

I'm trying to determine where within my code I need to place
'ObjectContext.SetAbort' Here's some pseudocode:
------------------------------------------------------

<%@ TRANSACTION = Required %>
<% CID = 45
insert_customer()
insert_trans (CID)

sub insert_customer
Set adoCmd = Server.CreateObject("ADODB.Command")
adoCmd.CommandText = "sp_addNewCustomerAndAccount"
adoCmd.ActiveConnection = ADOConnection
adoCmd.CommandType = adCmdStoredProc
adoCmd(1) = "Test"
adoCmd(2)= "xya"
adoCmd(3) = "chicago"
adoCmd.Execute
end sub

Sub insert_trans (CID)
Set RS = Server.CreateObject("ADODB.RecordSet")
adoCmd.ActiveConnection = ADOConnection
adoCmd.CommandText = "ADDTRANS"
adoCmd.CommandType = adCmdStoredProc

adoCmd(1) = CID
adoCmd(2) = 48.50
adoCmd(3) = 12
adoCmd(4) = "title"
adoCmd.Execute
check_err ()
End sub

sub check_err ()
If Err.number <> 0 then
ObjectContext.SetAbort
End if
end sub
%>
------------------------------------------------------
Now I've placed the check_err () at the end of my insert_trans sub because
if this is unsuccesful, I don't want the customer inserted either. The thing
is, if I purposely throw an error (within the stored proc, for example), sub
check_err does not get called. My question is, at what point should I call
check_err?

Also, if I remove this sub (and the call to it) altogether, the transaction
succesfully rolls back if I make it throw an error. I thought '
ObjectContext.SetAbort' must be somewhere in the code for this to occur?
Feb 17 '06 #1
0 1145

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

Similar topics

16
by: noah | last post by:
Does PHP have a feature to associate Cookie sessions with a persistent database connection that will allow a single transaction across multiple HTTP requests? Here is how I imagine my process: I...
1
by: Avanish Pandey | last post by:
Hello All We have 3 differen services (in 3 different server) Service A,B,C . We want to implement distributed transaction when call methods of B and C from A. Is it possible? if yes then how? ...
2
by: Mantorok Redgormor | last post by:
what is the purpose of the #line directive? how is it suppose to be used? I didn't see it mentioned in the faq and I can't make any sense of it from the standard. -- nethlek
2
by: John Lee | last post by:
Hi, I have few questions related to .NET 2.0 TransactionScope class behavior: 1. Check Transaction.Current.TransactionInformation.DistributedIdentifier to identify if distributed transaction...
15
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)...
5
by: Jim Heavey | last post by:
Is the Page directive only go on ".aspx" pages? I think the answer is yes, but I am not positive. I am trying to figure out why a called class can not be found and I was wondering if I should...
9
by: John Sidney-Woollett | last post by:
Is it possible to use the dblink and dblink_exec features from inside pl/pgsql functions to mimic the behaviour of nested transactions by calling another function or executing some SQL via the...
1
by: Matik | last post by:
Hi to all, Probably I'm just doing something stupid, but I would like you to tell me that (if it is so), and point the solution. There ist the thing: I' having a sp, where I call other sp...
2
by: RP | last post by:
I have a code like this: ========================================== private void cmdProceed_Click(object sender, EventArgs e) { GenerateAll(); } ========================================== ...
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: 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
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...

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.