microsoft.public.exchange.development
[Top] [All Lists]

Event Sink & DTC

Subject: Event Sink & DTC
From: BMW
Date: Sat, 14 Oct 2006 21:49:03 -0700
Newsgroups: microsoft.public.exchange.development
Hi,

I have sink event which is get data from incoming mail on Exchange server 
and put it on SQL server. Exchange server is on my domain server. SQL Server 
is on another machine. Both servers use Windows 2003 server as operating 
system. The data can be added if the exchange has Visual Studio. Without the 
visual studio is on Exchange server, the sink fire but no data is added to 
the table. 

The following is my VB code and stroe produce:

VB Code:

Using cn As New SqlConnection(strConnection)
                    cn.Open()
                    Using cmd As New SqlCommand("dbo.spDataTest", cn)
                        cmd.CommandType = CommandType.StoredProcedure
                        cmd.Parameters.Add("@Subject", SqlDbType.VarChar, 
50).Value = cdo_msg.Subject
                        cmd.Parameters.Add("@Result", SqlDbType.VarChar, 
100).Value = "testOct 12"                        
                       Dim rowsAffected As Integer = cmd.ExecuteNonQuery()
                        If (rowsAffected > 0) Then
                            Dim strResult As New StringBuilder
                            
strResult.Append(bstrSubject).Append("Transaction was committed. 
rowsAffected=").Append(rowsAffected)
                            Call sendMessage(strResult.ToString, 
cdo_msg.Subject)
                            scope.Complete()

                        Else
                            Dim str As New StringBuilder
                            str.Append("Failed").Append(" 
rowsAffected=").Append(rowsAffected)
                            Call sendMessage(str.ToString, cdo_msg.Subject)
                            scope.Dispose() 
                        End If
                    End Using ' Dispose the first command object.
                End Using ' Dispose (close) the first connection.
 ***********************************************************

Create PROCEDURE [dbo].[spDataTest] 
                 @Subject varchar(50),
                 @Result nvarchar(100)
AS
BEGIN
                SET NOCOUNT ON;
                 insert into dbo.Result (Subject, Result)values(@subject, 
@Result)
                return @@rowcount 
END


I don't understand the store procedure return @@rowcount is 1, but the data 
is not in the table. 
 
I always set the DTC timeout for 5 minutes.
 
Does anyone have idea what's wrong with my code?

 Thanks.



<Prev in Thread] Current Thread [Next in Thread>
  • Event Sink & DTC, BMW <=
Privacy Policy