Query the database using Linq to Entity
First, add the ADO.NET Entity Data Model in the project, as follows
New Connection
Check the resulting table
Click Finish to see the two entity data object model established
After a good model generation can be used directly
CustomerOrderEntities entity = new CustomerOrderEntities(); var queryResult = from n in entity.tblCustomer where n.Region =="Asia" select new { n.CustomerName,Orders= n.btlOrder}; foreach (var item in queryResult) { Console.WriteLine(item.CustomerName); foreach (btlOrder o in item.Orders) Console.WriteLine("orderId:" + o.OrderId + " Amount:" + o.Qty * o.Price); }