Hi,
You have to store the image in binary format. Storeimage converts
image to binary format. ConvertToBitmap converts it back. Note the offset
for the northwind database is 78 my storeimage function has a offset of 0.
Private Function StoreImage(ByVal bm As Bitmap) As Object
Dim ms As New MemoryStream
Try
bm.Save(ms, Imaging.ImageFormat.Jpeg)
Return ms.GetBuffer
Catch
Return Convert.DBNull
End Try
End Function
Private Function ConvertToBitmap(ByVal data() As Byte, ByVal offset As
Integer) As Bitmap
Dim ms As New System.IO.MemoryStream
Dim bm As Bitmap
ms = New MemoryStream
ms.Write(data, offset, data.Length - offset)
bm = New Bitmap(ms)
Return bm
End Function
Ken
----------------------
I have gone threw this tutorial. But when I retrieve the image from the DB.
The image is only 1B, and I cannot open it. The filename is correct.
Whats wrong here?