将PICTUREBOX中显示的图片(不知道图片路径),存入数据库中:
----------------------------------------------------------
----------------------------------------------------------
1
if
(
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}