Northwind Categories Picture MIME type

bri189a

Well-known member
Joined
Sep 11, 2003
Messages
1,004
Location
VA
Im doing a demo and for the life of me I cant figure out what kind of image file Microsoft filled the Picture field of the Categories table in the Northwind database, I started with what I thought would be it...bitmap, but nope, tried the usuals...jpg, gif, tiff, but still is rendering the broken image icon when Im databinding in my web page (and yes Im doing BinaryWrite)...so I can only conclude Im either A) using the wrong content type string, or B) they are using some off the wall format.

Any suggestions? Thanks!
 
Answer:

If anyone runs into this you cant put the picture in your web page the easy way, you have to do the bitmap in memory stream method:

//For old MS pictures in Northwind
System.IO.MemoryStream ms = new System.IO.MemoryStream();
// 78 is the size of the OLE header for Northwind images.
int offset = 78;

byte [] pic = (byte[])ds.Categories.FindByCategoryID(Convert.ToInt32(Request.QueryString["ID"])).Picture;
ms.Write(pic, offset, pic.Length - offset);

Bitmap bmp = new Bitmap(ms);

Response.ContentType = "image/jpeg";
bmp.Save(Response.OutputStream, System.Drawing.Imaging.ImageFormat.Jpeg);
ms.Close();

Thanks to:

http://www.ftponline.com/vsm/2002_07/online/hottips/esposito/

for the information...I never knew Northwind was originally access and converted to SQL...I thought it was the other way around.

Hope this helps someone in the future.
 
Back
Top