I have a problem saving images from PictureBox1 to my SQL server database, I\'ve done my research and found out that I have to convert my image to a byte array in order to d
In SQL SERVER database have datatype IMAGE. Keep the column datatype as IMAGE.
You can use the following sample code and pass Image to the below function which converts the image to byte to store in database.
public static byte[] ImageToByte2(Image img)
{
byte[] byteArray = new byte[0];
using (MemoryStream stream = new MemoryStream())
{
img.Save(stream, System.Drawing.Imaging.ImageFormat.Png);
stream.Close();
byteArray = stream.ToArray();
}
return byteArray;
}