How do I use a good transaction in a database? _asp Foundation
Source: Internet
Author: User
How do I use a good transaction in a database?
In the actual operation of the ASP, this situation always happens, such as in the Bank, from my account to Feiwenhua account transfer,
My account has been marked out, but due to the failure of the bank system, the expense Mandarin account database changes failed,
How should this be handled? The amount of my account should not be lost, right?
Your interests are of course not lost, the changed account database data will be automatically restored.
Here is the interactive function (TRANSACTION), which is made up of IIS and MTS (Mircrosoft TRANSACTION Server)
Done together. Its function is: When the ASP program in all the database changes are successful, the success;
Database changes have failed, other database records that have changed are automatically restored.
Both SQL Server and Oracle databases provide interactive functionality, but access is not available.
This interaction functions in the scope of an ASP program, which means that all databases involved in this program have interactive functions.
The method is to add the first line of the ASP program:
Transaction=required
To tell IIS this program to use interactive features, specific ASP programs:
<%@ transaction=required language= "VBScript"% >
......
<% Set Obj1 = Server.CreateObject ("testobj.cls1")% >
<% = obj1.data3t (1,10)% >
<%
Sub OnTransactionCommit ()
......
End Sub
Sub OnTransactionAbort ()
......
End Sub
% >
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service