Click here to Skip to main content
15,434,147 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
This is my code that generate error when saving picture to db == A generic error occurred in GDI+. Anybody please help me with this. Thank you very very much.


VB
If Not Me.pictureboxName.BackgroundImage Is Nothing Then
            Dim ms As MemoryStream = New MemoryStream
            Me.pictureboxName.BackgroundImage.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg)
            Dim data As Byte() = ms.GetBuffer()
            Dim p As New SqlParameter("@photo", SqlDbType.Image)
            p.Value = data
            cmd.Parameters.Add(p)
        End If
Posted
Comments
[no name] 24-Mar-14 21:57pm    
http://www.codeproject.com/Articles/437937/Save-and-Retrieve-Image-from-a-SQL-Server-Database

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900