Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void LoadProducts()
- {
- try
- {
- db = new Db();
- var gridvResult = (from u in db.Products
- join c in db.Categories on u.CatId equals c.CategoryId
- select new
- {
- PrId = u.ProductId,
- ProductName = u.ProductName.Substring(5), // Here I get error
- CategoryName = c.CategoryName,
- }).ToList();
- if (gridvResult != null)
- {
- dgvProduct.DataSource = null;
- dgvProduct.DataSource = gridvResult;
- dgvProduct.Columns[0].Visible = false;
- }
- }
- catch (Exception ex)
- {
- MessageBox.Show(ex.Message);
- Exception inner = ex.InnerException;
- while (inner != null)
- {
- MessageBox.Show(inner.Message);
- inner = inner.InnerException;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement