|
|
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.
|
|