Image img = picturebox_company_logo.Image as Image;
using (MemoryStream ms = new MemoryStream())
{
img.Save(ms, ImageFormat.jpeg);
byte[] bytes = ms.ToArray();
cmd.Parameters.Add("@compLogo", SqlDbType.Image).Value = bytes;
}
i am using C# and sqlserver... and am trying to get image from picturebox and store in into database... database column datatype is 'image'...
when i debug the code it gives exception on img.Save(ms, ImageFormat.jpeg);
and the exception message is A generic error occurred in GDI+.
i had tried every possible way but it didn't work out...
i tried to add user permission and other solutions also