How to use Transaction in the database?
In the actual operation of ASP, this always happens, such as transferring money from my account to Fei Wenhua's account in the bank.
My account shows that it has been marked out, but due to a failure of the bank's system, the database change of Fei Wenhua's account failed.
How should this be handled? There should be no loss in my account amount, right?
Of course, your interests are not lost, and the changed account database information will be automatically restored.
What is used here is the interactive function (TRANSACTION), which is composed of IIS and MTS (Mircrosoft Transaction Server)
Completed together. Its function is: it is considered successful when all database changes in the ASP program are successful; if one of them is
If the database changes fail, other database records that have been changed will be automatically restored.
Both SQL SERVER and ORACLE databases provide interactive functionality, but ACCESS does not.
This interactive function acts within the scope of an ASP program, that is, all databases involving this program have interactive functions.
The method is to add:
TRANSACTION=Required
To tell IIS this program to use interactive functions, specific ASP programs:
< %@ TRANSACTION=Required LANGUAGE="VBScript"% >
……
< % Set obj1 = ("testobj.cls1")% >
< % = obj1.data3t(1,10)% >
< %
Sub OnTransactionCommit()
……
End Sub
Sub OnTransactionAbort()
……
End Sub
% >
In the actual operation of ASP, this always happens, such as transferring money from my account to Fei Wenhua's account in the bank.
My account shows that it has been marked out, but due to a failure of the bank's system, the database change of Fei Wenhua's account failed.
How should this be handled? There should be no loss in my account amount, right?
Of course, your interests are not lost, and the changed account database information will be automatically restored.
What is used here is the interactive function (TRANSACTION), which is composed of IIS and MTS (Mircrosoft Transaction Server)
Completed together. Its function is: it is considered successful when all database changes in the ASP program are successful; if one of them is
If the database changes fail, other database records that have been changed will be automatically restored.
Both SQL SERVER and ORACLE databases provide interactive functionality, but ACCESS does not.
This interactive function acts within the scope of an ASP program, that is, all databases involving this program have interactive functions.
The method is to add:
TRANSACTION=Required
To tell IIS this program to use interactive functions, specific ASP programs:
< %@ TRANSACTION=Required LANGUAGE="VBScript"% >
……
< % Set obj1 = ("testobj.cls1")% >
< % = obj1.data3t(1,10)% >
< %
Sub OnTransactionCommit()
……
End Sub
Sub OnTransactionAbort()
……
End Sub
% >