I m using vb.net with Sqlserver2014.The under mentioned code works fine at the time of save but in update it works only when i update the picture column, If I want to update any other column it gives the Error: "A generic error occurred in GDI+"
Can anybody correct my code. I will be very thankful.
In my previous post there is an error in code, that's wyhy im posting with new code.
Dim Picvalue As Object = If(ProductPicture.Image Is Nothing, CObj(DBNull.Value), GetImageData(ProductPicture.Image))
cmd.Parameters.Add("@Picture", SqlDbType.VarBinary, -1).Value = Picvalue
Private Function GetImageData(image As Image) As Byte()
Dim data As Byte()
Using stream As New IO.MemoryStream
image.Save(stream, Imaging.ImageFormat.Jpeg)
data = stream.ToArray()
End Using
Return data
End Function