I'm trying to move this T-SQL stored procedure to a CLR procedure, but there's a Service Broker specific command that I don't know how to implement:
DECLARE @msgBody XML    
DECLARE @dlgId uniqueidentifier
;RECEIVE top(1) 
        @msg开发者_如何转开发Body    = message_body,      
        @dlgId      = conversation_handle    
FROM    dbo.TargetAuditQueue
Do you know how to the same thing on .net?
[SqlProcedure]
public void AuditParseEventData()
{
    // ???
}
Thanks!
    SqlCommand receiveCommand = contextConnection.CreateCommand();
    receiveCommand.Transaction = transaction;
    receiveCommand.CommandText = "RECEIVE TOP(1) message_body, conversation_handle FROM dbo.TargetAuditQueue";
    using (SqlDataReader reader = receiveCommand.ExecuteReader())
    {
        if (reader.Read())
        {
            SqlBinary messageBody = reader.GetSqlBinary(0);
            Guid conversationHandle = reader.GetGuid(1);
            // your stuff...
        }
    }
Also, note that conversation handle is something different than conversation ID. In your code you seem to be mixing these.
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论