Cannot convert type 'System.Data.Linq.Binary' to byte

I would like to get an image from linq & add it to a PictureBox.image.
I get the following error.......
Cannot convert type 'System.Data.Linq.Binary' to byte
My Code >>>>

using (EmployeeDataContext EmployeeCtx = new EmployeeDataContext(GlobalMethods.SqlConnectionString))
                {
                    var rsEmpTerminals = (from e in EmployeeCtx.Employees
                                          where e.Emp_EmployeeNumber_VC16 == empNo
                                          select e);


                    foreach (var item in rsEmpTerminals)
                    {
                             byte[] Empimage = (byte[])(item.Emp_Pic_IMG);
                             MemoryStream ms = new MemoryStream(Empimage);
                             pictureBox.SizeMode = PictureBoxSizeMode.StretchImage;
                             pictureBox.Image = Bitmap.FromStream(ms);
                    }    
                 }

Also this does not work

 pictureBox.Image = item.Emp_Pic_IMG;
u2envy1Asked:
Who is Participating?
 
u2envy1Connect With a Mentor Author Commented:
I found the problem......
In the .dbml where the table lies. Just right click on the field -> choose propeties. Change Type from Binary (System.Data.Linq.Binary) To byte[] (System.Byte[]) & use the code from above.
Hope this helps some1 out their !! :-)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.