Assign Sql Database to Gridview Usin LINQ in C#
LINQ to Entities does not recognize the method System.String ToString() method, and this method cannot be translated into a store expression.
LINQ to Entities does not recognize the method System.String ToString() method, and this method cannot be translated into a store expression.
Exception
In following code snippet, a LINQ to SQL query is executed on the records returned from the Entity Framework.
CustomersEntities entities = new CustomersEntities();
Gridview1.DataSource = (from p in entities.Customers
select new SelectListItem
{
Text = p.Name,
Value = p.CustomerId.ToString()
}).ToList();
Gridview1.DataBind();
Comments
Post a Comment