LINQ To Datatable......................
-
Hi experts I want to fill data table using LINQ but i have no dbml file i want to fill data table with dynamic LINQ Query.
What is the source of the data to fill the DataTable and is the DataTable already instantiated?
-
Hi experts I want to fill data table using LINQ but i have no dbml file i want to fill data table with dynamic LINQ Query.
Hi! There is no way to do it directly. The first way to do it is fill entity at first and then use CopyToDataTable() method. Since you haven't had dbml file (dataContext) you can't do it. Or more complex you should write your own extension method which takes ExpressionTree and translates it in string represntation then simply use standard DataSet approach for DataTable filling. (Still it is very inconvinent) Generally speaking it is not good itdea to mix DataSet and LinqToSQL approach in one project. More here: http://social.msdn.microsoft.com/Forums/en-US/adodotnetentityframework/thread/05996101-299e-423c-9137-e3b8d02890e1/