Until now, this is what I've done to place an image in picturebox1
from a database, but now I'm getting this error:
Unable to cast object of type
System.DBNull
to typeSystem.Byte[]
.
The already available solutions from this platform didn't work.
Image img;
byte[] bytimg = (byte[])dt.Rows[0]["Picture"];
//convert byte of imagedate to Image format
using (MemoryStream ms = new MemoryStream(bytimg, 0, bytimg.Length))
{
ms.Write(bytimg, 0, bytimg.Length);
img = Image.FromStream(ms, true);
pictureBox1.Image = img;
}