这样写代码吧
Dim imgStream As New IO.MemoryStream
Dim b As New Bitmap(pic1.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 = "数据源名"
cmd.CommandText = "update " & dr.datatable.name & " set 示意图1 = 0x" + ImageString + " where _Identify = " & dr("_Identify")
cmd.ExecuteNonQuery()