RE: Load images from database by Arjun
Arjun
Thu Jun 14 11:28:01 CDT 2007
Hi rick,
Thanx for the suggestion. While trying to sue the Butmap class, I ma still
facing some issues.
below is the code I am using:
================
Bitmap loadimage(byte[] picdata)
{
const int bmData = 78;
if (picData == null || picData.Length < bmData + 2) return null;
if (picData[0] != 0x15 || picData[1] != 0x1c) return null;
Bitmap bmp = null;
try
{
MemoryStream ms = new MemoryStream(picData.Length - bmData);
bmp = new Bitmap(ms);
}
catch { }
// return what we got
return bmp;
}
===========================
but this is giving errors while building that picdatadoes not exists.
Please suggest.
Thanx again for your help.
Regards,
Arjun
"dbgrick" wrote:
> Arjun,
> Use the Bitmap class instead of the image class. You can create a bitmap
> using a memory stream, which you can create from you database byte stream.
>
> Rick D.
> Contractor
>
> "Arjun" wrote:
>
> > Hi,
> >
> > I am trying to load images stored in database (SQL CE) inside a grid but
> > facing problems on how to go about the same.
> >
> > I am trying to use the Image class but do not find a method to read the
> > MemoryStream to get images.
> >
> > Please suggest.
> >
> > Regards,
> > Arjun