我现在急需一个例子,图片存入数据库中的例子.我用的是C/S模式的WINFORM程序,有什么好的解决方法也可以.最好是代码!!
因为时间比较急!!!1

解决方案 »

  1.   

    把图片转换成字符串,保存到数据库中.把数据库中的数据类型定义为TEXT可能是最不好的方法吧 哈哈  我就想到这个办法
      

  2.   

    byte[] pictureData=ConvertImage(pictureBox1.Image)
    再将数据库里字段类型设为Image,直接存进去就是了
      

  3.   

    转为byte类型后存入Image字段。
    byte[] imagebytes=null;
    FileStream fs=new FileStream(Image_path,FileMode.Open);
    BinaryReader br=new BinaryReader(fs);
    imagebytes=br.ReadBytes(br.Length);
    SqlParameter parInput22=cmd.Parameters.Add("@员工图片",SqlDbType.Image);
    parInput22.Direction=ParameterDirection.Input;
    cmd.Parameters["@员工图片"].Value=imagebytes;
    cmd.ExecuteNonQuery();
    数据库中操作图片
    How To Read and Write BLOB Data by Using ADO.NET with Visual C# .NET
    http://support.microsoft.com/default.aspx?scid=kb;EN-US;309158
    DataGrid显示图片(物理路径式和Stream流式)和添加图片到数据库
    http://singlepine.cnblogs.com/articles/288027.html
      

  4.   

    將圖片轉換成byte流,或者是序列化,確實可以解決這個問題,但是數據量是不是會很大呢?關注中....
      

  5.   

    ok   搞定了
    thanks