Re: size problem with ole object data type (blob) and ado.net

From: Trent Millar (thm101_at_hotmail.com)
Date: 04/28/04


Date: Wed, 28 Apr 2004 03:39:48 GMT

I know with some older image formats you must actually run ahead of some of
the old header input. For instance when using the Northwind database you
would have to edit your code below to this:

byte[] blob = (byte[]) (ds.Tables["employees"].Rows[0]["photo"]);
_stream.Write (blob, 78, blob.Length -78); // hack's out the old header info
_bitmap = new Bitmap (stream);

If you're certain that the images are there you should look into this as a
likely solution.

rgds,
Trent Millar

"Pierre-Benoit" <quertonp@hotmail.com> wrote in message
news:ccda81a5.0404270717.6020adb0@posting.google.com...
> Hi there,
>
> I've a strange problem with ado.net and an Access db. I need to create
> a little C# app that take the content of "ole object" field and then
> save it into a file.
>
> The problem is that when I do the following
>
> Byte[] byteBLOBData = new Byte[0];
> byteBLOBData = (Byte[])(ds.Tables["tblRefAlbum"].Rows[0]["photo"]);
>
> I get the exact double of the original size! and if I save this array
> byte to a file I'll get my file with every two byte set to 00.
>
> The result is, of course, not an image. I've tryed to manipulate my
> array of byte to strip every two bytes but the result is an visible
> image but not the correct image (it's a scrambled image that appears).
>
> Please help, I really need to do this exportation of picture in .net
> with the access db.
>
>
> Thanks a lot for people whom can help me.



Relevant Pages

  • Re: size problem with ole object data type (blob) and ado.net
    ... For instance when using the Northwind database you ... _bitmap = new Bitmap; ... > I've a strange problem with ado.net and an Access db. ... > array of byte to strip every two bytes but the result is an visible ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: size problem with ole object data type (blob) and ado.net
    ... For instance when using the Northwind database you ... _bitmap = new Bitmap; ... > I've a strange problem with ado.net and an Access db. ... > array of byte to strip every two bytes but the result is an visible ...
    (microsoft.public.dotnet.general)
  • Re: Pset and SetPixel Bug
    ... The method varies slightly depending on what kind of bitmap you are dealing with and also where you are getting it from. ... Once you know the address you can then point a SAFEARRAY structure at that data and access it from the array. ... Private Declare Function timeBeginPeriod _ ... Dim SourceWidth As Long, SourceHeight As Long ...
    (microsoft.public.vb.general.discussion)
  • Re: Pset and SetPixel Bug
    ... The method varies slightly depending on what kind of bitmap you are dealing with and also where you are getting it from. ... Once you know the address you can then point a SAFEARRAY structure at that data and access it from the array. ... Private Declare Function timeBeginPeriod _ ... Dim SourceWidth As Long, SourceHeight As Long ...
    (microsoft.public.vb.general.discussion)
  • Re: Scale a vector
    ... I need to resize a one-dimensional array. ... is greater than the width of the original bitmap. ... The array lenght must be the same, so I've to scale RGB proj. ... the value of the middle pixel, I think the solution is basically the ...
    (microsoft.public.dotnet.languages.csharp)