To send a message within an MS DTC external transaction, the MSMQCoordinatedTransactionDispenser is used to create the transaction object. After the transaction object is created, make sure it is referenced in the call to Send.
Dim xdispenser as New MSMQCoordinatedTransactionDispenser
Set xact = xdispenser.BeginTransaction
Set qSend = qinfo.Open(MQ_SEND_ACCESS, MQ_DENY_NONE)
msg.Label = "MyTransaction message" msg.Body = "Message 1 Body" msg.Send qSend, xact 'Associates send with xact.
This example sends a single message within an external transaction.
Dim xdispenser as New MSMQCoordinatedTransactionDispenser Dim xact as MSMQTransaction Dim qSend as MSMQQueue Dim msg as New MSMQMessage Set xact = xdispenser.BeginTransaction 'Assumes queue already exists and is transactional. Set qSend = qinfo.Open(MQ_SEND_ACCESS, MQ_DENY_NONE) msg.Label = "MyTransaction message" msg.Body = "Message 1 Body" msg.Send qSend, xact 'Associates send with xact.