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

quertonp_at_hotmail.com
Date: 04/28/04


Date: Wed, 28 Apr 2004 09:11:17 +0200

Hello,

This doesn't work. I've founded a similar example on the web and already
tryed. Nothing more. The problem is not really in the header of the data.
But more on how these data are retrived from db.

The value inside the field is correct. Because when I use a VBA function
(into an Access form) I get the image correctly on the disk.
But when use .Net I get a file wicth size is the exact double of the
original.

For example, here you'll find juste a little piece of the begining of the
original file (that work) and the one that has been generated from .net

Original:
FF D8 FF E0 00 10 4A 46 49 46 00 01 01
00 00 01

Generated file
FF 00 D8 00 FF 00 E0 00 00 00 10 00 4A
00 46 00

If a made a breakpoint directly after getting the value from the field with
ado.net and read the length of what i've retrived I get the orignial size *
2

I suppose that ADO.NET make something to bring me crazy :) So do I need to
change something I my connection string do tell ado to don't do anything
strange ?
   string strConnectionString="Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=c:\test\photodb.mdb;User Id=admin;Password=;";
   cnMDB = new OleDbConnection(strConnectionString);
   OleDbCommand cmdPhoto = new OleDbCommand(strQuery,cnMDB);
   cnMDB.Open();
   OleDbDataAdapter da = new OleDbDataAdapter(cmdPhoto);
   DataSet ds = new DataSet();
   da.Fill(ds, "tblRefAlbum");

Just after this instruction, the field size in the memory is twice the size
of the original data in db.

Help I need somebody, Help......

"Trent Millar" <thm101@hotmail.com> wrote in message
news:8IFjc.273614$Pk3.85830@pd7tw1no...
> 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
    ... The problem is not really in the header of the data. ... But when use .Net I get a file wicth size is the exact double of the ... >> 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: size problem with ole object data type (blob) and ado.net
    ... The problem is not really in the header of the data. ... But when use .Net I get a file wicth size is the exact double of the ... >> 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.framework.adonet)
  • renee.rtf.xaf
    ... \f4\i All header lines, including the initial BEGIN. ...
    (comp.lang.tcl)
  • Re: Passing an array of structuresfrom a pointer?
    ... I've tried an attempt to do that, and I tried to "clean" the header and main ..c file. ... int LIST_NUMBER; ... typedef struct ddListBox{ ... DDLB_COLL1array! ...
    (microsoft.public.vc.language)
  • Re: Raw image in header file
    ... Raw image in header file's a cool scene! ... initialiser for an array. ... FILE *cfp, *hfp; ... Dig the even newer still, yet more improved, sig! ...
    (comp.lang.c)

Quantcast