ObjectContext.SetComplete Method

IIS 6.0

The SetComplete method successfully completes a transaction. All components that are part of the transaction must call SetComplete for the transaction to complete as a whole.

SetComplete(
)

This method has no parameters.

This method has no return values.

The following example uses the SetAbort and SetComplete methods. The first example file, Sales.htm, obtains data required to process a sales request. The second file, SalesVerify.asp, contains a script that uses two objects, Inventory and Sales, to process the sale. SetAbort is called if Inventory returns an error code indicating that there is not sufficient inventory on hand to process the sale. If the Inventory object does not return the error code, SetComplete is called and the sale is processed.

--- Sales.htm --- 
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> 
<HTML> 
<HEAD> 
<TITLE>Sales Order</TITLE> 
</HEAD> 
<BODY BGCOLOR="#FFFFFF"><FONT FACE="ARIAL,HELVETICA"> 
<H2>Sales Order Form </H2> 
<FORM METHOD=POST ACTION="SalesVerify.asp">  
<P>Please enter the product code, quantity, and your account number. 
<INPUT TYPE=TEXT NAME=QuantityToBuy>  
<INPUT TYPE=TEXT NAME=ProductCode>  
<INPUT TYPE=TEXT NAME=AccountIn>  
<P> 
<INPUT TYPE=SUBMIT>  
</FONT>  
</BODY> 
</HTML> 

--- SalesVerify.asp --- 
<%@ Transaction = Required %> 
<% 
  Set CurrentQOH = Server.CreateObject("Mycomp.Inventory") 
  Set CurrentSales = Server.CreateObject("Mycomp.Sales") 
  CheckQuantity = Request("QuantityToBuy") 
  CheckProduct = Request("ProductCode") 
  QuantityStatus = CurrentQOH.CheckQOH(CheckQuantity,CheckProduct) 
  If QuantityStatus = None 
    ObjectContext.SetAbort 
    Response.Write "Sorry, there is not sufficient quantity on hand to process your sale." 
  Else  
    ObjectContext.SetComplete 
    Account = Request("AccountIn") 
    Saleupdate = CurrentSales.PostIt(AccountIn) 
  End If 
%> 

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

Show: