用你的方法,为何ImageString为空呢?
Dim dlg As New OpenFileDialog
dlg.Filter = "图形文件|*.bmp;*.jpg;*.gif;*.png"
If dlg.ShowDialog = DialogResult.OK Then
Dim fs As New IO.FileStream(dlg.FileName, 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语句,所以这里把二进制变成字符
msgbox(ImageString) '此处为何为空呢?
End If