void LoadData() { List <clsMenu> lt = new List <clsMenu>(); foreach (var item in db.Menu_Select()) { try { clsMenu m = new clsMenu(); m.ID = item.ID; m.Name = item.Name; m.GiaBan = item.GiaBan.GetValueOrDefault(); m.LoaiID = item.LoaiID.GetValueOrDefault(); m.SoLuong = 0; m.GhiChu = ""; if (item.HinhAnh != null) { MemoryStream st = new MemoryStream(item.HinhAnh.ToArray()); m.HinhAnh = Image.FromStream(st); } else { m.HinhAnh = Image.FromFile(Application.StartupPath + @"\ErrorImage.png"); } lt.Add(m); } catch { } } gcMenu.DataSource = lt; }