如题!

解决方案 »

  1.   

    用Imang控件里的DateBinding直接绑定到数据库的Image字段
      

  2.   

    不会就是这样绑吧!
    this.pesrImage.DataBind();
      

  3.   

    如何在WebForm上显示图像缩略图
    http://blog.csdn.net/knight94/archive/2006/03/31/645987.aspx
      

  4.   

    楼上!我想我要的只是数据库中某个人的照片是要根据Pers_id来查找的!
    这样的话应该要怎么做呢!
      

  5.   

    从数据库在按你的条件查找出存在数据库中的图像数据,可以用如下的方法试试:
    public Image getImage(object o)
    {
    Image img = null;
    byte[] bts = o as byte[];
    if (bts != null)
    {
    MemoryStream ms = null;
    try
    {
    ms = new MemoryStream(bts, 0, bts.Length);
    {
    img = Image.FromStream(ms, true);
    }
    }
    catch{}
    finally
    {
    if (ms != null)
    {
    ms.Close();
    }
    }
    }
    return img;
    }
      

  6.   

    以下参考
    ' 建立连接
            Dim con As SqlConnection = New SqlConnection("Server=(local)\NetSDK;Database=北风贸易;Integrated Security=SSPI")        ' 建立数据命令对象(亦即 SqlCommand 对象)
            Dim foxCMD As New SqlCommand        foxCMD.Connection = con
            foxCMD.CommandText = "SELECT * FROM dbo.虚拟工作室 WHERE 身份证号码 = @Id"        foxCMD.Parameters.Add("@Id", SqlDbType.NVarChar, 10).Value = ListBoxId.SelectedItem.ToString
            ' 打开连接
            con.Open()        Dim myReader As SqlDataReader = foxCMD.ExecuteReader(CommandBehavior.CloseConnection Or CommandBehavior.SingleResult Or CommandBehavior.SingleRow)' 建立一个 Byte 类型的数组(也就是字节数组)
                Dim bytBLOBData(myReader.GetBytes(13, 0, Nothing, 0, Integer.MaxValue) - 1) As Byte            ' 使用 GetBytes 方法将 照片 字段中的图像数据读入字节数组中
                myReader.GetBytes(13, 0, bytBLOBData, 0, bytBLOBData.Length)            ' 根据字节数组来建立一个 MemoryStream 对象
                Dim stmBLOBData As New MemoryStream(bytBLOBData)            ' 将 MemoryStream 对象加载 PictureBox 的 Image 属性中
                PictureBox1.Image = Image.FromStream(stmBLOBData)
      

  7.   

    img = Image.FromStream(ms, true);
    为何提示无效参数?vs2005中