I'm getting GDI+ error when saving picturebox image to the database. My database is sql server with image datatype. Ideally when I browse image file to the picturebox then save using following code
MemoryStream ms = new MemoryStream();
picMenu.Image.Save(ms, picMenu.Image.RawFormat);
Dim arrImage() As Byte = ms.GetBuffer
ms.Close();
then it works fine. when I bring back the same image from the database to picturebox and then re-save using the same code it gives me GDI+ exception. Does anyone have any clue why this would happen.
Would Image format be changed? I have also tried gif, jpeg etc image format.. but i get same error.