Hope someone can help me out...
I have been tasked to read some image data from an sql database and
save the files to flat files. OK, sounds easy as I'v used BLOBs
before. But this is an old database and I cannot get the image to
work.
The columns in the database are of type text. Here is one of the
images text (in full) in the database (I hope you can see it):
"GIF89a\0\0¢ÿ\0ÿÿÿÀÀÀ\0ÿÿ\0\0„\0\0\0 \0\0\0\0\0\0\0\0\0!ù
\0\0\0,\0\0\0\0\0\0@BºÜî J@ž²ÚÍy\0(RÊ0thª2X¤
¥_(ƒšyµïªïüJüÀߪERÂÀé2jLÐ\aòX Ús)¶Ç"
I have tried something along the lines of:
byte[] bytes = new byte[(oDatareader.GetBytes(0, 0, null,
0, int.MaxValue))];
oDatareader.GetBytes(0, 0, bytes, 0, bytes.Length);
System.Drawing.Image img =
System.Drawing.Image.FromStream(new MemoryStream(bytes));
Which works fine in my other apps. I also tried:
byte[] Test =
System.Text.UTF8Encoding.UTF8.GetBytes(ImageString );
Image x = Image.FromStream(new MemoryStream(Test));
But no go.
Can anyone reccomend anything? I appreciate any help.
Thanks,
ed