Try below code:
public byte[] imageToByteArray(System.Drawing.Image imageIn)
{
MemoryStream ms = new MemoryStream();
imageIn.Save(ms,System.Drawing.Imaging.ImageFormat.Gif);
return ms.ToArray();
}
Now save the byte array in the database.
Call the above method while saving image in the database:
command.Parameters.Add("@IMAGE", SqlDbType.VarBinary).Value = ConvertImageToByteArray(PictureBox1.Image);
While retriving the image from the database, again convert the byte array to image.
public Image byteArrayToImage(byte[] byteArrayIn)
{
MemoryStream ms = new MemoryStream(byteArrayIn);
Image returnImage = Image.FromStream(ms);
return returnImage;
}