Hi,
I am trying to write a LINQ query which will retrieve data from Customers table and store selected data in a List<string>.
I have written the following code:
public List<string> FillGrid()
{
LINQDALDataContext db = new LINQDALDataContext();
List<string> query =
from c in db.Customers
where (c.Country == "USA"
&& c.City == "WA")
select new { c.CustomerID, c.ContactTitle, c.Country, c,City};
return query.ToList();
}
I am getting the error in select statement:
Cannot implicitly convert type 'System.Linq.IQueryable<AnonymousType#1>' to 'System.Collections.Generic.List<BusinessObjects.Customers>'. An explicit conversion exists (are you missing a cast?)
I have tried a lot.
Any help will be thankfully accepted.
Partha