LINQ to Entities does not recognize the method 'Int32 Parse(System.String)' method when attempting to parse a column for inequality comparisons

后端 未结 7 1099
抹茶落季
抹茶落季 2020-12-09 15:55

I have following code in my page:

var myVar= Entity.SetName
                 .Where(p => int.Parse(p.ID) >= start &&
                  int.Pars         


        
相关标签:
7条回答
  • 2020-12-09 16:41
    private void LoadDetail(int id)
        {
            var sp = from category in db.ProductCategories
                     join product in db.Products on category.ProductCategoryID equals product.ProductCategoryID
                     where id == int.Parse(category.ProductCategoryID)
                     select new
                     {
                         product.ProductID,
                         product.ProductName,
                         product.ProductCode,
                         product.Deception,
                         category.CategoryName,
                         product.Quanrity,
                         product.Price
                     };
            DGVDetail.DataSource = sp.ToList();//help: Error: LINQ to Entities does not recognize the method 'Int32 Parse(System.String)' method, and this method cannot be translated into a store expression
        }
    
        private void DGVMaster_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            int index = e.RowIndex;
            LoadDetail(index + 1);
        } 
    
    0 讨论(0)
提交回复
热议问题