TransactionScope and Enterprise Library Application Block 2.0
I've a problem whit de TransactionScope and Enterprise Library Application Block 2.0, basically, I've a method, that it invoke to another class (My Dataservice) and this class uses Microsoft.Practices.EnterpriseLibrary.Data.dll To communicate whit the Database.
I make some proofs on my machine "PCLOCAL"(Windows XP SP2, SQL Server 2000 Developer Ed.), and it works fine, but, when I want to run the same code on another machine "PCREMOTESERVER" its similar that my computer (Windows XP SP2, SQL Server 2000 Developer Ed.), It doesn't work. I check the MSDTC configuration, its all ok, Accept access from the network and another check are checked.
This is the code on windows form:
Using transScope As New TransactionScope()
Dim objDts As New DataService("Password=;Persist Security Info=True;User ID=sa;Initial Catalog=Prueba;Data Source=PCREMOTESERVER")
Call objDts.ExecuteCommand("Insert into Clientes (Nombre) Values ('Hello1')")
Call objDts.ExecuteCommand("Insert into Clientes (Nombre) Values ('Hello2')")
Call objDts.ExecuteCommand("Insert into Clientes (Nombre) Values ('Hello3')")
Call objDts.ExecuteCommand("Insert into Clientes (Nombre) Values ('Hello4')")
Dim objDt As DataTable = objDts.ExecuteCommandDt("Select * From Clientes")
Dim objDtRow As DataRow = Nothing
For Each objDtRow In objDt.Rows
Call objDts.ExecuteCommand("Insert into Registros (IdCliente, IdRegistro, Descripcion) Values (" & objDtRow.Item("IdCliente") & ", 1, '" & objDtRow.Item("Nombre") & "')")
Next
' Commit the transaction.
Call transScope.Complete()
End Using
this is the code on DataService class:
Imports Microsoft.Practices.EnterpriseLibrary.Data
Imports Microsoft.Practices.EnterpriseLibrary.Data.Sql
Imports System.Data.Common
Imports System.Data
Public Sub ExecuteCommand(ByVal pStrCmm As String)
Dim objDb As SqlDatabase = Nothing
objDb.ExecuteNonQuery(CommandType.Text, pStrCmm)
End Sub
Public Function ExecuteCommandDt(ByVal pStrCmm As String) As DataTable
Dim objDb As SqlDatabase = Nothing
Dim objDs As DataSet = objDb.ExecuteDataSet(CommandType.Text, pStrCmm)
'- return
Return objDs.Tables(0)
End Function
This is de Error:
An unhandled exception of type 'System.Data.SqlClient.SqlException' occurred in Microsoft.Practices.EnterpriseLibrary.Data.dll
Additional information: MSDTC it is not available in the Server 'PCREMOTESERVER'.
Anybody can help me ?
Thank for all.
Note: sorry for my bad english

