从数据库读取图片并加载到image控件中,数据库有3个和图片相关的字段。字段名     类型
img        image
imgtype  varchar
imgsize   bigintimg 就是图片
imgtype 是ContentType
imgsize 是图片大小请问如何从数据库中取出图片并邦定到image控件中!

解决方案 »

  1.   

    http://dotnet.aspx.cc/ShowDetail.aspx?id=ECD9AE16-8FF0-4A1C-9B9F-5E8B641CB1B1
      

  2.   

    private void Page_Load(object sender, System.EventArgs e)
    {
    string PhotoId = Request["PhotoId"];
    //设置contenttype
    Response.ContentType = 
    //从数据库读出来
    string photoContent = getphotofromdatabase(PhotoId)
     
    Response.BinaryWrite( photoContent );
     
    }
      

  3.   

    <img src="photodownloader.aspx">
      

  4.   

    你可以把IMAGE OBJECTL转换成BYTE。然后放入数据库,取出时再转换回来。或者在数据库中存放保存图片的路径,然后用控件显示出来
      

  5.   

    pxk(钻石很久远)老兄说的方法我用过,不知道有没有更好的方法!
      

  6.   

    http://community.csdn.net/expert/Topicview2.asp?id=3684758