@TRANSACTION

You can use the @TRANSACTION processing directive to indicate that the script should be treated as a transaction. If a script is treated as a transaction, Component Services creates a transaction to coordinate the updating of resources.

句法

<%@ TRANSACTION = value %>

参数

Value
A string that indicates the type of transaction support. Possible values include the following:

ValueMeaning
RequiredAlways participates in a transaction, and initiates a transaction if one does not currently exist.
Requires_NewAlways initiates a new transaction.
SupportedParticipates in a transaction if one exists but does not require a transaction.
Not_SupportedNever participates in a transaction. If called from a script that is using transactions, the script containing the@TRANSACTION processing directive still runs but outside of the context of the transation.

备注

If a script contains the @TRANSACTION directive, it must be the very first line in the .asp file, otherwise an error is generated. You must add the directive to each page that should be run under a transaction. The current transaction ends when the script finishes processing.

If the script containing the @TRANSACTION directive has been called by either the Server.Transfer or Server.Execute method, and the value is specified as Required, the script continues the transaction of the calling ASP page, if the calling ASP page was transacted. If the calling ASP page was not transacted, the called ASP page creates a new transaction.

For example, the following two scripts would be considered one transaction:

<%@ TRANSACTION=Required %> 
<% 
  Server.Transfer("/asp/asp2.asp") 
%> 
ASP2 
<%@ TRANSACTION=Required%> 
<% 
  Server.CreateObject("Mytransactedcomponent.Closeout") 
%>

必备条件

Client: Requires Windows XP Professional, Windows 2000 Professional, or Windows NT Workstation 4.0.

Server: Requires Windows Server 2003, Windows 2000 Server, or Windows NT Server 4.0.

Product: IIS

如果你喜欢这篇文章,敬请给站长打赏↑

除特别注明外,本站所有文章均为本站站长原译,转载请注明出处。