HOWTO: Send a Data Recordset Using Microsoft Message Queue Server Message BodyID: Q179575
|
Using Microsoft Message Queue Server (MSMQ) and Microsoft Remote Data
Service (RDS), you can send and receive a data recordset using MSMQ message
body.
Follow these steps to run the code example below:
http://www.microsoft.com/data/rds/
Private Sub Form_Load()
Dim rs As ADOR.Recordset
Dim sql As String
Dim RDS as Object
Dim dataFactory As Object
Dim qinfo As New MSMQQueueInfo
Dim mSend As New MSMQMessage
Dim mReceive As MSMQMessage
Dim qSend As MSMQQueue
Dim qReceive As MSMQQueue
qinfo.PathName = ".\RecordsetQ"
qinfo.Label = "My Recordset Queue"
On Error Resume Next ' ignore if the queue already exists
qinfo.Create
Set qSend = qinfo.Open(MQ_SEND_ACCESS, MQ_DENY_NONE)
Set RDS = CreateObject("RDS.DataSpace")
Set dataFactory = RDS.CreateObject("RDSServer.DataFactory","localhost")
sql = "select * from authors"
Set rs = dataFactory.query("driver={SQL
Server};SERVER=(local);database=pubs;uid=sa;pwd=", sql)
mSend.Label = "Testing Recordset"
Set mSend.Body = rs
mSend.Send qSend
qSend.Close
MsgBox "Message sent with Recordset"
Set qReceive = qinfo.Open(MQ_RECEIVE_ACCESS, MQ_DENY_NONE)
Set mReceive = qReceive.Receive
Set rs = mReceive.Body
Debug.Print rs(0) ' print column 1
Debug.Print rs(1) ' print column 2
Debug.Print rs(2) ' print column 3
rs.movenext
Debug.Print rs(0) ' print column 1
Debug.Print rs(1) ' print column 2
Debug.Print rs(2) ' print column 3
End Sub
Microsoft Message Queue Server SDK Help.
Remote Data Service (RDS) documentation located at this Web address:
http://www.microsoft.com/data/rds/
Additional query words: kbdse
Keywords : kbcode kbRDS150 kbRDS200
Version : WINDOWS:1.0,2.0; winnt:1.0
Platform : WINDOWS winnt
Issue type : kbhowto
Last Reviewed: February 2, 1999