求高人指点

解决方案 »

  1.   

    读的是路径的话
    那就直接绑定他的URL
    <asp:ImageButton ID="ImageButton1" runat="server" ImageUrl="<%# Eval("数据库字典") %>" />二进制的话。。
     Image1.ImageUrl="Photo.aspx?id="+Request.QueryString["id"];
    photo.aspx
    int Id=Request.QueryString["id"]==null?0:int.Parse(Request.QueryString["id"].ToString());
    using(SqlConnection conn=new SqlConnection())
    {
    conn.ConnectionString="";  
    string strSql="select * from A where Id='"+Id+"'";  
    SqlCommand cmd=new SqlCommand(strSql,conn) ;
    conn.Open();
    SqlDataReader reader=cmd.ExecuteReader();
    if(reader.Read())
    {
    Response.ContentType = "application/octet-stream";
    Response.BinaryWrite((Byte[])reader["Photo"]);
    }
    Response.End();
    }
      

  2.   

    是路径,数据库字典里面写什么?比如我的数据表叫Picrure  字段:P_ID  P_name   
     <asp:ImageButton ID="ImageButton1" runat="server" ImageUrl="<%# Eval("P_name") %>" />
    是吗?
      

  3.   

    可是我想绑定的是数据表里面P_ID=1的字段对应的P_name 怎么绑呢?
      

  4.   

    这个id对应的P_name就是图片路径
      

  5.   

    先获取id,然后读取数据库的时候加上where子句