将PICTUREBOX中显示的图片,存入数据库中
将PICTUREBOX中显示的图片(不知道图片路径),存入数据库中:
----------------------------------------------------------
----------------------------------------------------------
1if (null != picBox.Image)
2{
3 using(System.IO.MemoryStream ms = new System.IO.MemoryStream())
4 {
5 picBox.Image.Save(ms, picBox.Image.RawFormat);
6 Byte[] bt = new Byte[ms.Length];
7 ms.Read(bt, 0, ms.Length);
8 //将bt作为参数,传入 DBCOMMAND即可
9 }
10}
2{
3 using(System.IO.MemoryStream ms = new System.IO.MemoryStream())
4 {
5 picBox.Image.Save(ms, picBox.Image.RawFormat);
6 Byte[] bt = new Byte[ms.Length];
7 ms.Read(bt, 0, ms.Length);
8 //将bt作为参数,传入 DBCOMMAND即可
9 }
10}
作者: 三角猫
http://www.zu14.cn/
转载请保留此信息