-- 作者:baoxyang
-- 发布时间:2011/5/20 16:45:00
-- 求教,这样保存图片如何写?
Dim dlg As New OpenFileDialog \'定义一个新的OpenFileDialog dlg.Filter= "图文文件|*.jpg" \'设置筛选器 If dlg.ShowDialog = DialogResult.Ok Then
Dim ss As String = dlg.FileName Dim fs As New IO.FileStream(ss, IO.FileMode.Open , IO.FileAccess.Read)
Dim br As New IO.BinaryReader(fs)
Dim ImageByte() As Byte = br.ReadBytes(fs.Length)
Dim ImageString As String = BitConverter.ToString(imageByte).Replace("-", "")
Dim cmd As New SQLCommand cmd.C Dim r As Row = Tables("人事档案_Table1").current Dim s As String = r("工号") cmd.CommandText = "Update {员工档案} set 相片1 = 0x" + ImageString +" where 工号 = \'"& s &"\'" cmd.ExecuteNonQuery()
r("相片1") = “0x" & ImageString ‘这个会出错,请教这个代码如何写? e.Form.Controls("PictureBox1").Image = GetImage(ss) End If
上述代码,黑体部分是把图片通过SQL语句来实现,如果直接在窗口表中实现,如斜体部分。语句如何写?请指教!!先谢了!!!
此主题相关图片如下:未命名.jpg

[此贴子已经被作者于2011-5-20 16:46:25编辑过]
|