又来一个啊姨~!
用Ado.Strem将文件写入字段.
网上大把类似代码.只要你肯定去找

解决方案 »

  1.   

    读取数据库中的图片
    byte[] buffByte = null;

    buffByte = ((byte[])dt.Rows[0]["photo"]);
    System.IO.MemoryStream ms = new System.IO.MemoryStream(buffByte);

    //通过流对象建立Bitmap

    System.Drawing.Bitmap bmp = new Bitmap(ms);

    this.pictureBox1.Image = bmp;
      

  2.   

    添加图象
    定义 photo为文件的物理路径作为参数FileStream   fs232   =   new   FileStream(photo,   FileMode.OpenOrCreate,   FileAccess.Read);   
              
    //建立一个新的图片对象
    byte[]   img=   new   byte[fs232.Length];   
    fs232.Read(img,   0,   System.Convert.ToInt32(fs232.Length));   
              
    fs232.Close(); 
    最后向数据库添加img对象就可以了~