This site has been taken over by the staff of www.ASPDeveloper.Net

Please report errors to suggest@aspdeveloper.net

BizTalk Utilities CV ,   Jobs ,   Code library  
 
Home Page
Microsoft ASP
The ObjectContext.OnTransactionCommit Event
The ObjectContext.OnTransactionAbort Event
The ObjectContext Object
The Application.StaticObjects Collection
The Application.Contents Collection
The Application.UnLock Method
The Application.Lock Method
The Application.Contents.RemoveAll() Method
The Application.Contents.Remove(name|index) Method
The Application.OnStart() Event
The Application.OnEnd() Event
The Application Object
The ASPError.Source Property
The ASPError.Number Property
The ASPError.Line Property
The ASPError.File Property
The ASPError.Description Property
The ASPError.Column Property
The ASPError.Category Property
The ASPError.ASPDescription Property
<< LAMP
 

By :Mark Wilson
I am the creator of TopXML. I am available for international and local (Australia) contracts. I am a Solution Architect/Business Analyst. I have worked in IT in several countries (NZ, Australia, South Africa, UK) building and training teams for government and very large non-governmental organizations. I am ex-Microsoft Consulting Services. I wrote the first book on Microsoft XML published in 2000 called XML Programming with VB and ASP. Most recently I have been building tools for the SEO industry. Ask me for a 37 point SEO health-checkup for your website.
First posted :03/24/2008
Times viewed :1275

 

The ObjectContext.SetAbort Method

Introduction

The ObjectContext.SetAbort method can be used to abort a transaction. Any made changes will be rolled back and if the event OnTransactionAbort is implemented then it will be executed. You have to add the @Transaction directive otherwise the method will not work. The following example connects to a SQL server and uses the WHERE statement to retrieve some specific data from the table. However the data does not exist, therefore it will execute the ObjectContext.Abort method.

Example

<% @Transaction = "Required" %>

<%

            Dim conn, connString

            set conn = Server.CreateObject("ADODB.Connection")

            connString = "Provider=SQLOLEDB;Data Source=localhost;Database=YOUR_DBASE;UID=YOUR_USER;Pwd=YOUR_PW"

            conn.Open connString

            Dim rs, sql

            sql = "Select * from YOUR_TABLE where YOUR_FIELD='xx'"

            set rs = conn.execute(sql)

            If rs.BOF Or rs.EOF Then

                        ObjectContext.SetAbort

                        Response.Write "No data found"

            end if

%>

Output


Rate this article on a scale of 1 to 10

Your vote :  


 

Recent Jobs

Software Specialist, Linux - Finlan
Linux Core Technical Project Manage
Graphics designer at Tanzania. Expe
Integration Specialist Needed - Wor
Virtualization Server Infrastructur

View all Jobs (Add yours)
View all CV (Add yours)






    Email TopXML  

Front Page Daily Stuff TopXML Forum XML blogs XML Newsgroups BizTalk Biztalk Utilities Biztalk Utilities Tutorial B2B SAP XML Microsoft .NET Dotnet System XML Soapformatter SQLXML XMLserializer XQuery PHP PHP SimpleXML PHP XML Dom PHP XML RPC PHP XSLT Java Java Java XML Xalan Microsoft ASP ASP Schemas XML SQL Server XML XMLDom XSL XSL Tutorial XSLT Stylesheets General Javascript CSS XHTML WAP