Hello,
im having a problem and i would like some help. I ll try describemy situation. I have a database table with two fields,
one is a varchar and the other is an image field. the image fieldis used to store documents in byte stream format. What i need todo is export all data from that table and import it to a similartable on a different database. The way im doing that isexporting all the data into xml files and then i read the xmlfiles and put the data into the database i want to import datainto. I need to do it that way bcos the import will not takeplace str8 after the export (otherwise could all be done instored procedures). My problem is reading the image field fromthe xml. The xml field that holds a document as byte streamlooks like that:
<Letter_template>0M8R4KGxGuEAAAAAAAAAAAAAAAAAAAAAP gADAP7...moredata here....</Letter_template>
I read the xml using XmlTextReader. The problem is that allvalues are read as strings form the xml (obviously). but toinsert the <Letter_template> into the database field i need itas a byte[]. if i try to cast the string it doesn't work. Forexample im reading the value doing the following:
XmlTextReader reader = new XmlTextReader("xmlFilePath");
while (reader.Read())
{
// found <letter_Template> tag
// read content
string string_byte_array = reader.Value; // returns stringanyway
int numBytes = (int) string_byte_array.Length;
byte[] letter_template = new byte[numBytes];
// how the heck im i gonna put the string into the byte []array?
}
hope you have understood my problem.
how the heck, am i gonna read a string that already contains abyte stream (as a string representation), into a byte[] withoutencoding it further...
Thanx for reading my problem...
PS: Sorry for my english
--------------------------------
From: Andreas N.
-----------------------
Posted by a user from .NET 247 (
http://www.dotnet247.com/)
<Id>/33PAmG49Um2Dq05k1zJLw==</Id>