Amit Joshi

Amit Joshi

  • NA
  • 122
  • 35.2k

Linq to SQL

Apr 16 2015 3:36 PM
I am using entity framework and Linq to fetch the data.
 
I have to tables Product and Order Detail. In Order detail table I have order Id and Product Id. While displaying data in gridview  I am fetching data from order detail table. But I don't want to show Product Id in the grid. Instead of that I want to show related product name from product table.
 
I have EDMX file which has created two classes Product and Order detail. I am using LINQ to fetch data from Order details table. How can I get Product Name of related product ID. Method return type can not be Order detail. It gives me below error.
 
 Cannot implicitly convert type 'System.Linq.IQueryable<AnonymousType#1>' to 'System.Collections.Generic.List<OrderDetail>
 
 
 

Answers (6)