LINQ to Entities does not recognize the method 'System.String ToString()' method in MVC 4

前端 未结 4 1241
温柔的废话
温柔的废话 2020-12-03 02:35

I\'m working with MVC 4 and I have to update my database using Code First Migrations. What I\'m trying to do is to select records from a database table, and insert them int

4条回答
  •  春和景丽
    2020-12-03 03:20

    just use delegate :

    var query = dba.blob.Select(delegate(blob c)
    {
        return new SelectListItem
            {
                Value = c.id.ToString(),
                Text = c.name_company,
                Selected = c.id.Equals(3)
            };
    });
    

提交回复
热议问题