Write binaryfile to table/dataset and then to XMLFile ....
-
I put a binary file into a table in a dataset. I then write my dataset as a XMLfile using DataSet.WriteXML When I look at the field with my file-content I have a string wich look like this ... "/9j/4AAQSkZJRgABAgEAYABgAAD/7ABzRHVja3kAAQAEAAAAPAADAF4AAAAtA<" What kind of string is that? How can I get it without using dataset/writexml to get it? I have a special solution where I need to get that string. Please hekp // henrik
-
I put a binary file into a table in a dataset. I then write my dataset as a XMLfile using DataSet.WriteXML When I look at the field with my file-content I have a string wich look like this ... "/9j/4AAQSkZJRgABAgEAYABgAAD/7ABzRHVja3kAAQAEAAAAPAADAF4AAAAtA<" What kind of string is that? How can I get it without using dataset/writexml to get it? I have a special solution where I need to get that string. Please hekp // henrik
How are you storing your binary file before putting in the datatable? If you store binary file in byte[] then Google for 'convert byte array to string' You can use BinaryReader class for reading binary data.
Giorgi Dalakishvili #region signature my articles #endregion
-
I put a binary file into a table in a dataset. I then write my dataset as a XMLfile using DataSet.WriteXML When I look at the field with my file-content I have a string wich look like this ... "/9j/4AAQSkZJRgABAgEAYABgAAD/7ABzRHVja3kAAQAEAAAAPAADAF4AAAAtA<" What kind of string is that? How can I get it without using dataset/writexml to get it? I have a special solution where I need to get that string. Please hekp // henrik
I think the DataSet uses Base64 encoding when it serializes binary fields into XML. I may be wrong, but it is the most common way to encode binary data in XML. To read it, you could use a System.Xml.XmlReader (and its ReadElementContentAsBase64 method once you've located the correct field). However, the normal way to do it would be to recreate the dataset from the XML file, though (using ReadXml on a new dataset)... If for some reason you don't want to use the system-provided XML tools and instead want to read the file as text and do your own decoding, you can either google for base64 or use, for example, System.Convert.FromBase64String.
-
I think the DataSet uses Base64 encoding when it serializes binary fields into XML. I may be wrong, but it is the most common way to encode binary data in XML. To read it, you could use a System.Xml.XmlReader (and its ReadElementContentAsBase64 method once you've located the correct field). However, the normal way to do it would be to recreate the dataset from the XML file, though (using ReadXml on a new dataset)... If for some reason you don't want to use the system-provided XML tools and instead want to read the file as text and do your own decoding, you can either google for base64 or use, for example, System.Convert.FromBase64String.