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

You do not show the lines of codes for passing of parameter values for other that binary type.
I can assume that your problem is in the declaration of parameter type and there size. You can use 'Parameters.AddWithValue' function to assign parameter value and there is no need to mention parameter type & size.

cmd.Parameters.AddWithValue("@Picture", Picture)
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.