How would I go about retrieving data from multiple tables in a single query in Linq? I have two tables (Customers and Orders) and I want to retrieve the orders that a specific customer has placed when the user clicks on that customer record on the screen. I have everything working other than using the first name to query the database. This is in ASP.NET MVC btw. Below is my controller action code for retrieving the orders:
public ActionResult GetCustomerOrders(string firstName)
{
//this is the code in question!!
var customerOrders = from cust in db.CustomerRecords
select cust;
return PartialView("CustomerRecordDisplay", (IQueryable<CustomerRecord>)db.CustomerRecords);
}
Question
winlonghorn
How would I go about retrieving data from multiple tables in a single query in Linq? I have two tables (Customers and Orders) and I want to retrieve the orders that a specific customer has placed when the user clicks on that customer record on the screen. I have everything working other than using the first name to query the database. This is in ASP.NET MVC btw. Below is my controller action code for retrieving the orders:
Link to comment
Share on other sites
1 answer to this question
Recommended Posts