用sql语句插入吧。
Dim fs As New IO.FileStream("D:\a.JPG" , IO.FileMode.Open , IO.FileAccess.Read) '用文件流打开图片
Dim br As New IO.BinaryReader(fs) '根据文件流,申明一个二进制阅读器
Dim ImageByte() As Byte = br.ReadBytes(fs.Length) '阅读器读取文件流,并将独到的二进制放入数组ImageByte中,
Dim ImageString As String = BitConverter.ToString(imageByte).Replace("-", "") ' SQLCommand 不能直接Insert 二进制,只能拼接SQL语句,所以这里把二进制变成字符
Dim cmd As SQLCommand = new SQLCommand()
cmd.ConnectionName = "SqlServerDB"
cmd.CommandText = "Insert aaa values(0x" + ImageString + ")" '这里的ImageString 就是前4条几句根据图片转换来的字符串
'拼接结果为 Insert aaa values(0xFFD8FFE000104A46494600010101006000600000FFDB004………………)
cmd.ExecuteNonQuery()