本文整理汇总了VB.NET中System.Web.UI.TemplateControl.AbortTransaction事件的典型用法代码示例。如果您正苦于以下问题:VB.NET TemplateControl.AbortTransaction事件的具体用法?VB.NET TemplateControl.AbortTransaction怎么用?VB.NET TemplateControl.AbortTransaction使用的例子?那么恭喜您, 这里精选的事件代码示例或许可以为您提供帮助。您也可以进一步了解该事件所在类System.Web.UI.TemplateControl 的用法示例。
在下文中一共展示了TemplateControl.AbortTransaction事件的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的VB.NET代码示例。
示例1: OnAbortTransaction
private Sub Page_Load(Sender As Object, e As EventArgs)
AddHandler Me.myCommitTransaction,AddressOf Sub_CommitTransaction
AddHandler Me.myAbortTransaction,AddressOf Sub_AbortTransaction
try
Dim myAccount As Account = New Account()
Dim someAmount As Integer = 500
myAccount.Debit(someAmount)
ContextUtil.SetComplete()
catch e1 As Exception
ContextUtil.SetAbort()
End Try
End Sub
Public event myCommitTransaction As System.EventHandler
Public event myAbortTransaction As System.EventHandler
protected overrides Sub OnCommitTransaction(e As EventArgs )
RaiseEvent myCommitTransaction(Me ,e)
Response.Write("<br /><br />The 'OnCommitTransaction()' method is used to raise the 'CommitTransaction' event." )
End Sub
protected overrides Sub OnAbortTransaction(e As EventArgs)
RaiseEvent myAbortTransaction(Me ,e)
Response.Write("<br /><br />The 'OnAbortTransaction()' method is used to raise the 'AbortTransaction' event." )
End Sub
private Sub Sub_AbortTransaction(Sender As Object, e As EventArgs)
' Code for RollBack activity goes here.
Response.Write("Transaction Aborted")
End Sub
private Sub Sub_CommitTransaction(Sender As Object, e As EventArgs)
' Code for Commit Activity goes here.
Response.Write("Transaction Commited")
End Sub
开发者ID:VB.NET开发者,项目名称:System.Web.UI,代码行数:41,代码来源:TemplateControl.AbortTransaction
注:本文中的System.Web.UI.TemplateControl.AbortTransaction事件示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论