Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > Transaction Directive

Thread Tools

Transaction Directive

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

<%@ TRANSACTION = Required %>
<% CID = 45
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"
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"
check_err ()
End sub

sub check_err ()
If Err.number <> 0 then
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

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?
Reply With Quote

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
Win2003 SP1 error: "New transaction cannot enlist in the specified transaction coordinator" Vencz Istv?n ASP General 2 05-02-2005 05:53 AM
long time transaction Eitan ASP .Net 3 04-11-2005 03:46 PM
Error in OLEDB Transaction Eitan ASP .Net 4 04-10-2005 02:56 AM
The 'Location' attribute is not supported by the 'OutPutCache' directive????when i set in the directive .NET Follower ASP .Net 1 02-13-2004 10:32 AM
Is transaction-based debugging useful ? ben cohen VHDL 0 08-20-2003 02:03 AM