Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsVB SyntaxEnterprise DevelopmentDatabase AccessControlsCOMWin APICrystal ReportDeploymentGeneralGeneral 2
Related Topics
VB.NET / ASP.NETMS SQL ServerMS AccessOther Database ProductsMore Topics ...

VB Forum / Database Access / February 2006



Tip: Looking for answers? Try searching our database.

How to handle double byte data in ADO??

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Ivan - 24 Feb 2006 10:49 GMT
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

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.