Ask a Question related to ASP Components, Design and Development.
-
Eric #1
Transactions
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?
Eric Guest
-
Transactions and Locking
I could do with some help on implementing locking in a multiuser environment. The scenario is quite simple and I'm temporarily using MS Access to... -
Transactions in Access
Just a quickie, is it possible to do transactions in Access, in that for example I can execute 3 different update or insert statements and if one of... -
Transactions....HELP!
Hello everybody ;-) I have a major question of correctness and performance (IDS 7.31 on AIX 4.somthing). (If you cant work out what I am on about... -
[PHP] HTTP transactions with PHP?
<snip> Is it possible to make a complete HTTP transaction from within PHP? Like: - PHP sends request headers (with POST data) to $url - $url... -
Transactions - ADO/SQL or both?
Hi, When considering transactions should you: 1) - Put a begin and end tran inside every SP that alters data? 2) - Use the ADO Transaction...



Reply With Quote

