title: How to Export data to Excel using LINQ to Entity?
body: <p>I have the data coming from Entity Data model table on my ASP.NET page.
  Now I have to export this data into Excel on button click.</p>
  
  <p>If it is using OLEDB, it is straight forward as it is here: <a href="http://csharp.net-informations.com/excel/csharp-excel-oledb-insert.htm" rel="noreferrer">http://csharp.net-informations.com/excel/csharp-excel-oledb-insert.htm</a> </p>
  
  <p>Here is my function to read data from inquiries table:</p>
  
  <pre><code>var model = from i in myEntity.Inquiries
              where i.User_Id == 5
                          orderby i.TX_Id descending
                          select new {
                              RequestID = i.TX_Id,
                              CustomerName = i.CustomerMaster.FirstName,
                              RequestDate = i.RequestDate,
                              Email = i.CustomerMaster.MS_Id,
                              DocDescription = i.Document.Description,
                              ProductName = i.Product.Name
  </code></pre>