ÉèΪÊ×Ò³ ¼ÓÈëÊÕ²Ø

TOP

ͼƬÉÏ´«µ½SQLServer(¶þ)
2014-11-24 07:22:24 À´Ô´: ×÷Õß: ¡¾´ó ÖРС¡¿ ä¯ÀÀ:3´Î
Tags£ºÍ¼Æ¬ ´«µ½ SQLServer
" where id=" + context.Request.QueryString["id"];

SqlDataReader reader = cmd.ExecuteReader(

CommandBehavior.CloseConnection | CommandBehavior.SingleRow);

if (reader.Read())

{

byte[] imgbytes = null;

string imgtype = null;

if (reader.GetValue(0) != DBNull.Value)

{

imgbytes = (byte[])reader.GetValue(0);

imgtype = reader.GetString(1);

// If bmp, convert to jpg and show because of the different formation type.

if (imgtype.Equals("image/bmp", StringComparison.OrdinalIgnoreCase))

{

using (MemoryStream ms = new MemoryStream(imgbytes))

{

using (Bitmap bm = new Bitmap(Image.FromStream(ms)))

{

bm.Save(context.Response.OutputStream, ImageFormat.Jpeg);

}

}

}

else

{

context.Response.ContentType = imgtype;

context.Response.BinaryWrite(imgbytes);

}

}

else

{

imgbytes = File.ReadAllBytes(context.Server.MapPath

("~/DefaultImage/DefaultImage.JPG"));

imgtype = "image/pjpeg";

context.Response.ContentType = imgtype;

context.Response.BinaryWrite(imgbytes);

}

}

reader.Close();

context.Response.End();

}

}

public bool IsReusable

{

get

{

return false;

}

}

}

Ê×Ò³ ÉÏÒ»Ò³ 1 2 ÏÂÒ»Ò³ βҳ 2/2/2
¡¾´ó ÖРС¡¿¡¾´òÓ¡¡¿ ¡¾·±Ìå¡¿¡¾Í¶¸å¡¿¡¾Êղء¿ ¡¾ÍƼö¡¿¡¾¾Ù±¨¡¿¡¾ÆÀÂÛ¡¿ ¡¾¹Ø±Õ¡¿ ¡¾·µ»Ø¶¥²¿¡¿
·ÖÏíµ½: 
ÉÏһƪ£º×ܽ᣺ÁùÖÖɾ³ýÊý¾Ý¿âÖØ¸´Ðеķ½·¨ ÏÂһƪ£º³õ̽PHPµÄSQL×¢Èë¹¥»÷µÄ¼¼ÊõʵÏÖ..

ÆÀÂÛ

ÕÊ¡¡¡¡ºÅ: ÃÜÂë: (ÐÂÓû§×¢²á)
Ñé Ö¤ Âë:
±í¡¡¡¡Çé:
ÄÚ¡¡¡¡ÈÝ:

¡¤Linuxϵͳ¼ò½é (2025-12-25 21:55:25)
¡¤Linux°²×°MySQL¹ý³Ì (2025-12-25 21:55:22)
¡¤Linuxϵͳ°²×°½Ì³Ì£¨ (2025-12-25 21:55:20)
¡¤HTTP Åc HTTPS µÄ²î„ (2025-12-25 21:19:45)
¡¤ÍøÕ¾°²È«±ØÐ޿ΣºÍ¼ (2025-12-25 21:19:42)