BorisAro
Зарегистрирован: 16.03.2007 Сообщения: 1
|
Добавлено: Пт Мар 16 2007 12:50 Заголовок сообщения: obtain BLOB data like doc or xml from Acces DB |
|
|
Hello! (VS 2005 VB)
I have an Access DB one of the fields is BLOB, which may contain documents or images. I found examples how to obtain bmp images from BLOB fields like this(works perfect):
Array.Copy(BLOB, 78, imgbytes, 0, BLOB.Length - 7
Dim strmImage As New MemoryStream(imgbytes)
ImageFile = Image.FromStream(strmImage)
Clipboard.Clear()
Clipboard.SetImage(ImageFile)
' paste into the RichTextBox control
Me.RichTextBox1.Paste()
But this doesn't work for any other type of documents.
I tried to read doc, xml into a disk file, and after that show it with WebBrowser, but the file is really corrupted. Seems that I must to cut some bytes from BLOB or may be add. That's what I did for xml or doc:
stream = New FileStream( _
FileName, FileMode.OpenOrCreate, FileAccess.Write)
writer = New BinaryWriter(stream)
writer.Write(BLOB)
Me.WebBrowser1.Navigate(FileName)
But the file is corrupted. Please help. |
|