Re: how to update binary field types in ADO
- From: "Richard Mueller [MVP]" <rlmueller-nospam@xxxxxxxxxxxxxxxxxxxx>
- Date: Tue, 27 Feb 2007 23:03:43 -0600
One technique suggested by Paul Randall works in some cases. He writes a hex
value to an ADO stream, then reads it back as a byte array. This may help
you:
===============
Function HexStrToOctet(strInput)
' Function to convert hex string to an OctetString (byte array).
' Based on a program by Paul Randall, October, 2002.
Dim orginalLocale, adoStream
' Retain original locale setting.
originalLocale = SetLocale(1033)
Set adoStream = CreateObject("ADODB.Stream")
' Write hex string to stream.
adoStream.Type = 2
adoStream.Charset = "x-ansi"
adoStream.Open
adoStream.WriteText strInput, 0
' Read stream as byte array.
adoStream.Position = 0
adoStream.Type = 1
HexStrToOctet = adoStream.Read
' Restore original locale setting.
SetLocale(originalLocale)
End Function
--
Richard Mueller
Microsoft MVP Scripting and ADSI
Hilltop Lab - http://www.rlmueller.net
--
.
- Follow-Ups:
- Re: how to update binary field types in ADO
- From: everymn
- Re: how to update binary field types in ADO
- References:
- how to update binary field types in ADO
- From: everymn
- Re: how to update binary field types in ADO
- From: Richard Mueller [MVP]
- how to update binary field types in ADO
- Prev by Date: Re: how to update binary field types in ADO
- Next by Date: Re: how to update binary field types in ADO
- Previous by thread: Re: how to update binary field types in ADO
- Next by thread: Re: how to update binary field types in ADO
- Index(es):
Relevant Pages
|