[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.odbcnet

Re: Reading Text datatype into a byte Array

madfiddler

5/24/2005 4:19:00 PM

Debu

I understand the issue you have is that the source data is a string which is
a single-byte character set. But as soon as you read this into a string
variable in .NET it becomes unicode.

I'm not sure if you can use the OleDbDataReader to effectively read in a
byte mode rather than as string data. If you can then this is obviously the
way to go.

You should also be aware that you can convert from one code page to another
using the Encoding class, which should get around the problem you are having.

Dim UnicodeString as String = "TEST"
Dim Enc As Encoding
Dim CodePage1252_ByteArray as Byte() =
Enc.GetEncoding(1252).GetBytes(UnicodeString)

as well as the GetEncoding method you may also find useful the Convert
method amongst others!


Hope that helps!





"Debu" wrote:

> Hi Cor,
>
> I want to read it as a byte array, not the way you thought of i.e.
> reading it as a string then converting it to byte array.
>
> Regards,
>
> Debu
>
>