![]() | |
![]() |
| | Thread Tools | Search this Thread | Display Modes |
#1
| |||
| |||
|
|
Hi, I'm trying to execute a distributed transaction using the following code: Imports System.Data.SqlClient Imports System.EnterpriseServices Imports System.Runtime.InteropServices Transaction(TransactionOption.Required), _ ClassInterface(ClassInterfaceType.None)> _ Public Class SimpleServicedComponent Inherits ServicedComponent Public Function TestServersConnection() As String Dim transaction As ITransaction transaction = ContextUtil.Transaction Dim strDBConn2 As String Dim sqlConn2 As New SqlConnection Dim sqlCMD2 As New SqlCommand Dim blnRes2 As Boolean strDBConn2 = "server=itsrv2;uid=sa;pwd=sasa;database=DB;Enlist= false" sqlConn2.ConnectionString = strDBConn2 sqlCMD2.CommandType = CommandType.Text sqlCMD2.CommandText = ("update accounts set balance = 10 ") sqlCMD2.Connection = sqlConn2 sqlConn2.Open() sqlConn2.EnlistDistributedTransaction(transaction) Try blnRes2 = sqlCMD2.ExecuteNonQuery If blnRes2 Then ContextUtil.SetComplete() Else ContextUtil.SetAbort() End If Catch e As SqlException Throw e Finally sqlConn1.Close() End Try End Function End Class The following error is generated at run time: "An error occurred while enlisting in a distributed transaction." I really need help on this ASAP. Your help is highly appreciated. Regards, Hadeel |
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
| |