【 tulaoshi.com - ASP.NET 】
                             
                             首先建一个显示图片的文件show.aspx,其中show.aspx.cs文件这样写:
private void Page_Load(object sender, System.EventArgs e)
 {
 // 在此处放置用户代码以初始化页面
 SqlConnection conn = new SqlConnection(ConfigurationSettings.AppSettings["connstr"].ToString());
 conn.Open();
 string id = Request.QueryString["id"];
 DataSet ds = new DataSet();
 byte[] myData = new byte[0];
 SqlDataAdapter da = new SqlDataAdapter("select picture from tablename where id="+id,conn);
 da.Fill(ds,"product");
 DataRow myRow;
 myRow = ds.Tables["tablename"].Rows[0];
 if(myRow["picture"].ToString()!="")
 myData = (byte[])myRow["picture"];
 Response.ContentType ="jpg";
 Response.BinaryWrite( myData );
 }
然后再在你要显示图片的文件上写:
 
                        来源:http://www.tulaoshi.com/n/20160129/1489848.html