problem when insert empty imag to database

  • Thread starter Thread starter ahmeddc
  • Start date Start date
A

ahmeddc

Guest
hi

The following code is used to add an image to the database
A problem when there is no image in the Picturebox cod does not work
If there is a picture in the Picturebox, the code works well

Dim ms As New MemoryStream
PictureBox1.Image.Save(ms, PictureBox1.Image.RawFormat)
Dim img() As Byte
img = ms.ToArray()
UPDATE_COM.Parameters.AddWithValue("@WEBSERVERPAYED_IMAG", img)




try

If Me.PictureBox1.Image Is Nothing Then
img = CObj(DBNull.Value)

Else
img = ms.ToArray()

End If

Continue reading...
 
Back
Top