I want to convert my Model data to DataSet or DataTable (to export in excel format)
db.EMPs.ToList()
db
You can use ToDataTable extension method but you need to install MoreLinq first. To install MoreLINQ, run the following command in the Package Manager Console:
PM> Install-Package morelinq
Then add the following line to your using directives:
using MoreLinq;
And finally you can use ToDataTable extension method:
DataTable s = db.EMPs.ToDataTable();