Ramesh G

Ramesh G

  • NA
  • 212
  • 65.2k

Image not show in picture box

Oct 17 2019 12:42 AM
i have get store the image in varbinay format in sql datatbase. i get the record in data table. record show in datatable,bt show time error occured.how can i fix the error
 
Error: .'fromstream parameter is not valid" 
 
if (dt.Rows.Count > 0)
{
 
   Byte[] MyData = new byte[0];
   MyData = ((Byte[])dt.Rows[0]["Company_Logo"]);
      if (MyData != null)
         {
            MemoryStream stream = new MemoryStream(MyData);
            pbox_logo.Image = Image.FromStream(stream);
         }

Answers (2)