Hi All,
I am trying to store the message id/correlation id from a MSMQ message
into a database table but am having trouble doing so as the data type
of the message id is of type Variant (array of bytes).
In VBScript how can I convert this data type in order to store as a
varchar in
a SQL Server 2000 db table?
When I run the code (from Michael Harris),where sMsgId is the array of
bytes for an MSMQ message Id, I get
=F2c=B3=8B=AEvG=80O^=F0"=F40=FF back as my character string:
ChrString =3D ""
NumValues =3D ""
HexValues =3D ""
comma =3D ""
for n =3D 0 to ubound(sMsgId)
ChrString =3D ChrString _
& midb(sMsgId,n+1,1) & chrb(0)
NumValues =3D NumValues & comma _
& asc(midb(sMsgId,n+1,1) & chrb(0))
HexValues =3D HexValues & comma _
& "0x" & hex(asc(midb(sMsgId,n+1,1) & chrb(0)))
comma =3D ","
next
msgbox "Typename: " & typename(sMsgId) & vbcrlf _
& "Vartype: " & vartype(sMsgId) & vbcrlf _
& "ChrString: " & ChrString & vbcrlf _
& "NumValues: " & NumValues & vbcrlf _
& "HexValues: " & HexValues & vbcrlf
-------------------------------------------
I also tried and get the same result:
For j =3D 1 To Lenb(sMsgId)
sMessageId =3D sMessageId & Chr(AscB(MidB(sMsgId, j)))
Next=20
Thanks for any help
Patrick