How to Export data to Excel using LINQ to Entity?
Posted
by Rita
on Stack Overflow
See other posts from Stack Overflow
or by Rita
Published on 2010-02-04T19:39:23Z
Indexed on
2010/03/22
7:31 UTC
Read the original article
Hit count: 1282
Hi
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.
If it is using OLEDB, it is straight forward as it is here: http://csharp.net-informations.com/excel/csharp-excel-oledb-insert.htm
Here is my function to read data from inquiries table:
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
© Stack Overflow or respective owner