vb.net 保存图片到数据库 就差最后一步了,各位看看谢谢
蛋蛋の忧伤 2008-04-23 10:54:59 '变压器图片
Dim b() As Byte
Dim fs As IO.FileStream
Dim br As IO.BinaryReader
Public Function add_byqImages() As Boolean
dbobj.ConnectionStr = connDBStr
dbobj.ConnectDB()
Dim strsql As String = ""
'文件读入内存
Try
fs = New IO.FileStream("E:\1.jpg", IO.FileMode.Open, IO.FileAccess.Read)
br = New IO.BinaryReader(fs)
b = br.ReadBytes(fs.Length)
Catch ex As Exception
MsgBox("文件读入内存错误!" & ex.Message)
Finally
br.Close()
fs.Close()
End Try
'---------------------------------------
这里面的SQL语句的参数怎么写呢?谢谢
Try 图片编号 变压器编号 变压器图片(blob类型)
strsql = "insert into dygl_byq_img_info(img_id,byq_id,img) values({0},{1},?)"
strsql = String.Format(strsql, 1, 1)
'---------------------------------------
dbobj.DoWithBLOBField(strsql, "dd", b)
Catch ex As Exception
MsgBox("内存到数据库==" & ex.Message)
End Try
End Function