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
----------------------
"Kenneth" <Ke*****@discussions.microsoft.com> wrote in message
news:B7**********************************@microsof t.com...
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?
"Cor Ligthert" wrote:
Mike,
There is a newer one on MSDN
http://support.microsoft.com/default...b;EN-US;308042
However when I see all those setting to nothing as well in that, I get
the
idea that it is written and than it was ready.
Cor
"Mike McIntyre" <mi****@dotnetshowandtell.com>
.. To read images from and write images to Sql Server see this MSDN
article:
http://support.microsoft.com/default...b;en-us;326502
--
Mike
Mike McIntyre
Visual Basic MVP
www.getdotnetcode.com
"DapDap" <pi******@hotmail.com> wrote in message
news:1c****************************@phx.gbl...I have manage to open a image into a picture box. But I
have problem in Saving it into database SQL Server. How
to save the image ??