还不如用代码插入
Dim imgStream As New IO.MemoryStream
Dim PictureBox1 As WinForm.PictureBox = e.Form.Controls("PictureBox1")
Dim b As New Bitmap(PictureBox1.Image)
b.Save(imgStream, System.Drawing.Imaging.ImageFormat.Jpeg)
Dim imageByte As Byte() = imgStream.GetBuffer
imgStream.Dispose()
Dim ImageString As String = BitConverter.ToString(imageByte).Replace("-", "") ' SQLCommand 不能直接Insert 二进制,只能拼接SQL语句,所以这里把二进制变成字符
Dim cmd As SQLCommand = new SQLCommand()
cmd.ConnectionName = "SqlServerDB"
cmd.CommandText = "Insert into 表名 (列名) values (0x" + ImageString + ")" '这里的ImageString 就是前4条几句根据图片转换来的字符串
cmd.ExecuteNonQuery()
[此贴子已经被作者于2016/5/15 23:07:56编辑过]