zoukankan      html  css  js  c++  java
  • ASP脚本里加事务

     

    事务声明:将某个页声明为事务性,可在页首添加 @TRANSACTION 指令:

    <%@ TRANSACTION = value %>

    value 参数可以是下列之一:

    意义

    Requires_New

    启动一个新的事务。

    Required

    启动一个新的事务。

    Supported

    不启动事务。

    Not_Supported

    不启动事务。

    @TRANSACTION 指令必须在一页中的第一行,否则将产生错误。不要将应用程序的 Global.asa 文件声明为事务性。

    事务终止:ObjectContext.SetAbort显式地声明终止一个事务。

    事务的响应:使用OnTransactionCommitOnTransactionAbort事件来编写对用户的不同响应。

    <%@ TRANSACTION = Required %>

    <%

    'Buffer output so that different pages can be displayed.

    Response.Buffer = True

    %>

    <HTML>

    <BODY>

    <H1>Welcome to the online banking service</H1>

    <%

    Set BankAction = Server.CreateObject("MyExample.BankComponent")

    BankAction.Deposit(Request("AcctNum"))

    %>

    <P>Thank you. Your transaction is being processed.</P>

    </BODY>

    </HTML>

    <%

    ' Display this page if the transaction succeeds.

    Sub OnTransactionCommit()

     Response.Write "<HTML>"

     Response.Write "<BODY>"

     Response.Write "Thank you. Your account has been credited."

     Response.Write "</BODY>"

     Response.Write "</HTML>"

     Response.Flush()

    end sub

    %>

    <%

    ' Display this page if the transaction fails.

    Sub OnTransactionAbort()

     Response.Clear()

     Response.Write "<HTML>"

     Response.Write "<BODY>"

     Response.Write "We are unable to complete your transaction."

     Response.Write "</BODY>"

     Response.Write "</HTML>"

     Response.Flush()

    End sub

    %>

  • 相关阅读:
    python opencv PyQt5
    各大web服务器https的证书文件
    mysql 常用字符串操作
    python 修改字符串中的某一位字符
    python mysql
    小程序
    m4a 转MP3
    安装python 3.7
    树莓派版本信息
    bash 重启后台程序脚本
  • 原文地址:https://www.cnblogs.com/glume/p/1232399.html
Copyright © 2011-2022 走看看