views:

76

answers:

3

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 called Aspose.

A: 

You should be able to set the DataSource property to the results of any Linq query.

Randy Minder
I need this in order to pass it to a third party software called Aspose.
Abe Miessler
@Abe - what exactly do you need to pass to Aspose? A dataset, an IEnumerable, an IQueryable...
Randy Minder
Any of the structures i mentioned in my post or IDataReder
Abe Miessler
+1  A: 

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.

Hemme
actually that might work. Can you elaborate?
Abe Miessler
A: 

See This LINK

MicroSoft

SharpCorner

Waleed A.K.
From what I understand CopyToDataTable has been discontinued for VS 2010.
Abe Miessler