Hello all.
My name is Oscar and I’m a novice on XML and ADO.NET arguments.
I need some help to resolve (and understand ) the following problem:
I have stored some data in a SqlServer database. I read data stored in database using a DbDataAdapter which fill a dataset.
One of the columns DataType of the dataset is a System.Byte[ ] containing an array of bytes. (In the SqlServer database it is stored as VarBinary field).
For example: Byte[] _binaryCmd =0x15,0x00,0xFF,0xFF,0x12,0x5D,0x81,
0xD5,0x00,0xAB,0x00,0x00,0x00,0x01,0x00,0x00,0x00, 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF};
I read the Xml representation of the data stored in the dataset, using the GetXml() methods, but I’m not able to read the value of the Byte[ ] field. These seems converted in some way. For example in the Xml element I read:
FQD//xJdgdUAqwAAAAEAAAD///////8=, whereas if I read the field of the dataset I can read correctly the byte array:
0x15,0x00,0xFF,0xFF,0x12,0x5D,0x81,0xD5,0x00,0xAB, 0x00,0x00,0x00,0x01,0x00,0x00,0x00,0xFF,0xFF,0xFF, 0xFF,0xFF,0xFF
The same situation happen if I put the dataset in an XmlDataDocument.
Please someone could explain me as I can obtain the original value of the Byte[ ] field in the XML representation?
Many thanks in advance.