Is there an easy way to do this or do I just need to go through each record and insert it into whatever data structure I go with?
I need it in this format in order to pass it to a third party software开发者_StackOverflow called Aspose.
DataSets are about DataTables; DataTables and DataViews are about DataRows. Linq queries are about objects.
If you want to execute a Linq2SQL query or Linq2Entities query and put the result into a collection of DataRows you will have to manually convert each instance of your query result to a DataRow type (and define the various DataColumns...).
The trivial solution of you question is using a LINQ query towards a DataTable... it will return a set of DataRows... but I don't think this is the main point of you question.
You should be able to set the DataSource property to the results of any Linq query.
精彩评论