Connecting Tech Pros Worldwide Forums | Help | Site Map

Reading access ole fields

Marco Castro
Guest
 
Posts: n/a
#1: Nov 20 '05
Along time ago I created an access database where I used the ole field type
to store images. If I look at the table data it has the work Picture in its
field. The image in that field displays properly if I display it from
inside of access but I can't figure out how to convert what's in there to
anything useful outside of access.

Is there some way to read what's in there from a .net application? I would
be content with just being able to display the picture in an application but
really I would like a way to extract them from there and converting them to
a real picture format. Can someone help me out with this dilemma please.
Thanks.



Ken Tucker [MVP]
Guest
 
Posts: n/a
#2: Nov 20 '05

re: Reading access ole fields


Hi,

Access stores the images in binary format. Here is a function that
converts the binary data into a bitmap. I put a parameter for offset
because the northwind database has an offset of 78.

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
-------------
"Marco Castro" <marco_dontspamme@benlan.com> wrote in message
news:uSaC8SLIEHA.3476@TK2MSFTNGP11.phx.gbl...[color=blue]
> Along time ago I created an access database where I used the ole field[/color]
type[color=blue]
> to store images. If I look at the table data it has the work Picture in[/color]
its[color=blue]
> field. The image in that field displays properly if I display it from
> inside of access but I can't figure out how to convert what's in there to
> anything useful outside of access.
>
> Is there some way to read what's in there from a .net application? I[/color]
would[color=blue]
> be content with just being able to display the picture in an application[/color]
but[color=blue]
> really I would like a way to extract them from there and converting them[/color]
to[color=blue]
> a real picture format. Can someone help me out with this dilemma please.
> Thanks.
>
>[/color]


Closed Thread


Similar Visual Basic .NET bytes