williamku87
Member
- Joined
- Jun 25, 2008
- Messages
- 7
- Programming Experience
- Beginner
who can help me in vb.net code for save and open the image from the database?
thanks
thanks
Last edited:
Dim connection As New SqlConnection(TextBox1.Text)
' Insert the image and comment into the database
Try
Dim oImg As FileStream = New FileStream("C:\SteelCoil.jpg", FileMode.Open, FileAccess.Read)
Dim oBinaryReader As BinaryReader = New BinaryReader(oImg)
Dim oImgByteArray As Byte() = oBinaryReader.ReadBytes(CType(oImg.Length, Integer))
connection.Open()
Dim cmd As New SqlCommand("update TABLE set FIELD = @pic where FIELD= '123'", connection)
cmd.Parameters.Add("@pic", oImgByteArray)
cmd.ExecuteNonQuery()
catch
end try