private void GetCategorias() { try { CategoriesDAO oDAO = new CategoriesDAO(); categorias = oDAO.RetrieveAll(); var tmpCategorias = (from c in categorias select new { Categoria = c.CategoryName, Descripcion = c.Description, }).ToList(); dgvDatos.DataSource = null; dgvDatos.DataSource = tmpCategorias; } catch (Exception e) { MessageBox.Show(e.Message, "MyStoreDesktop"); } }
private void GetCategorias() { CategoriesDAO oDAO = new CategoriesDAO(); categorias = oDAO.RetrieveAll(); if (categorias != null) { if (categorias.Count != 0) { categoriaCmBox.DisplayMember = "CategoryName"; categoriaCmBox.ValueMember = "CategoryID"; categoriaCmBox.DataSource = (from c in categorias select new { c.CategoryID, c.CategoryName }).ToList(); } } }