|
-
Sep 16th, 2002, 06:39 PM
#1
Thread Starter
Member
Page level transactions
I am trying to define a simple transaction at page level but it is
failling. I have added a reference to System.EnterpriseServices and on the page I have set these directives:
<%@ Page Language="vb" Transaction="Required" ... %>
<%@ Assembly Name="System.EnterpriseServices.dll" %>
<%@ Import Namespace="System.EnterpriseServices" %>
In a button, on the code-behind module I have:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim cn As OleDbConnection
Dim cm As OleDbCommand
Try
'open connection here
cm = New OleDbCommand()
With cm
.Connection = cn
.CommandType = CommandType.Text
.CommandText = "INSERT INTO tb_ccg(id_ccg, num_ccg)
VALUES (1, '21')"
.ExecuteNonQuery()
'Table name is wrong
.CommandText = "INSERT INTO tb_ccgss(id_ccg, num_ccg) VALUES (2,'32')"
.ExecuteNonQuery()
End With
ContextUtil.SetComplete()
Catch Ex As Exception
ContextUtil.SetAbort()
Finally
cn.Close()
End Try
On the second command, the table name is wrong, so I need that all the commands be aborted. But the first command is executed while the second is not. Am I missing something?
Thanks,
Robert
-
Sep 16th, 2002, 07:07 PM
#2
Hyperactive Member
Check to see if you had done 2 things
1) Inherit the ServicedComponent Class into your appropriate class. Then you will have full implementation of the COM+ application service component.
2) Add this attribute before the transactional unction call
<Transaction(TransactionOption.Required)>
William T
Software Architect / Chief Software Developer
Softwaremaker.Net Pte Ltd
http://www.Softwaremaker.net
*** Things are always the darkest before they go pitch black ***
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|