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

Re: Event Sink

Subject: Re: Event Sink
From: "Henning Krause"
Date: Sat, 14 Oct 2006 14:04:36 +0200
Newsgroups: microsoft.public.exchange.development
Hello,

are you using integrated authentication with your database connection? If so, the security context you are using is different.

So you must either use SQL authentication (bad) or give the user account under which the event sink runs the privileges to call your stored proc (better)

Best regards,
Henning Krause

"BMW" <BMW@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message news:FD0E0448-02EB-4AE4-97F0-0544C4D0BC1A@xxxxxxxxxxxxxxxx
Hi,

I have sink event which is get data from incoming mail and put it on SQL
server. Both Server are under same doamin. 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]

           -- Add the parameters for the stored procedure here

           @Subject varchar(50),
           @Result nvarchar(100)


AS

BEGIN

           -- SET NOCOUNT ON added to prevent extra result sets from

           -- interfering with SELECT statements.

           SET NOCOUNT ON;



   -- Insert statements for procedure here

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>
Privacy Policy