A,
Here is a sample of 2 ASP pages wrapped in one transaction. ASP 1 calls ASP 2.
The @TRANSACTION directive on each page ties the results of each page into 1 transaction.
We will commit the transaction first, then abort the transaction, effectively
rolling back the transaction.
Let me know if you have other questions..
Kevin...
ASP Page 1
<% @ LANGUAGE=VBScript TRANSACTION=REQUIRED%>
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<TITLE></TITLE>
</HEAD>
<BODY>
<P> Starting here</P>
<P> </P>
<%dim i
if objectcontext is nothing then
response.write("no object context"

Response.End
end if
'Execute the code on page 2 all wrapped in one transaction
Response.Write ("Going to Page 2<BR>"
'server.execute or server.transfer is an IIS5 command
server.execute "Page2.asp"
Response.Write ("Back from Page 2<BR>"
'Even though we committed the trans in page 2, this setabort should rollback the
'transaction
objectcontext.setabort
%>
</BODY>
</HTML>
<%
' Called if the transaction succeeds
Sub OnTransactionCommit()
Response.Write "<hr />"
Response.Write "<p><strong>Page 1 Transaction Committed</strong></p>"
End Sub
Sub OnTransactionAbort()
Response.Write "<hr />"
Response.Write "<hr />"
Response.Write "<p><strong>Page 1 Transaction Aborted</strong></p>"
End Sub
%>
ASP Page 2
<% @ LANGUAGE=VBScript TRANSACTION=REQUIRED %>
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<TITLE></TITLE>
</HEAD>
<BODY>
<%
Dim conn, rs
set conn = server.CreateObject("ADODB.Connection"

set rs = server.CreateObject("ADODB.Recordset"

if conn is nothing then
Response.Write("conn nothing"

response.end
end if
Set rs = CreateObject("ADODB.Recordset"

if rs is nothing then
Response.Write("rs nothing"

response.end
end if
'using an oracle database
'replace with your connect string
conn.connectionstring = "provider=MSDAORA.1;user id=xxx;password=xxx;data source=xxx;"
conn.open
'replace with your update command
st = "update otchfile set OTCHCHGTYP = 'Changed' where otchcrtcod = 'A' and otchcasnbr = '200205' "
rs.open st, conn
Set conn = nothing
Set rs = nothing
'Here, inside the called page, the transaction will commit
ObjectContext.SetComplete
%>
</BODY>
</HTML>
<%
' Called if the transaction succeeds
Sub OnTransactionCommit()
Response.Write "<hr />"
Response.Write "<p><strong>Page 2-Transaction Committed</strong></p>"
End Sub
' Called if the transaction fails
Sub OnTransactionAbort()
Response.Write "<hr />"
Response.Write "<p><strong>Page 2-Transaction Aborted</strong></p>"
End Sub
%>