Dear all,
I have a VB program which retrieves double data from a AS400 database
using ADO connection.
cnn.Open "Provider=IBMDA400;Data Source=myAS400Machine;", "", ""
Suppose the name of my result recordset is myRst, even when I use msgbox
to see the value in the record set (Msgbox myRst.Fields("myField"), I got the
following error:
Run-time error '-2147467259(80004005)':
Converted 24 bytes, 2 errors found beginning at offset 0
I am so frustrated by this problem. Can anyone advise how to solve it??
Thanks in advance.
Ivan
Richard Mueller - 27 Feb 2006 01:32 GMT
> I have a VB program which retrieves double data from a AS400 database
> using ADO connection.
[quoted text clipped - 12 lines]
> I am so frustrated by this problem. Can anyone advise how to solve it??
> Thanks in advance.
Hi,
Many data types cannot be displayed with MsgBox. In this case it might be a
byte array. You can tell using the TypeName function. TypeName returns
"Byte()" for byte arrays. You can convert a byte array to a hex string. For
example:
arrbytValue = myRst.Fields("myField").Value
Call MsgBox("Data type: " & TypeName(arrbytValue))
Call MsgBox("Byte array converted to hex string" & vbCrLf &
OctetToHexStr(arrbytValue))
Function OctetToHexStr(arrbytOctet)
' Function to convert OctetString (byte array) to Hex string.
Dim k
OctetToHexStr = ""
For k = 1 To Lenb(arrbytOctet)
OctetToHexStr = OctetToHexStr _
& Right("0" & Hex(Ascb(Midb(arrbytOctet, k, 1))), 2)
Next
End Function

Signature
Richard
Microsoft MVP Scripting and ADSI
Hilltop Lab - http://www.rlmueller.net