I'm new to C# and to LINQ, experienced with VB and .NET's DataXXXX objects. My LINQ queries (calling stored procedures in LINQ data context) return IEnumerable and ISingleResult or IMultipleResult types that are not compatible with the data objects I'm
used to. Is there information around that shows how to efficiently get the LINQ results into a datatable or dataset?
boyscout
Member
91 Points
29 Posts
Getting LINQ results from SQL db into dataset
May 08, 2008 01:41 PM|LINK
I'm new to C# and to LINQ, experienced with VB and .NET's DataXXXX objects. My LINQ queries (calling stored procedures in LINQ data context) return IEnumerable and ISingleResult or IMultipleResult types that are not compatible with the data objects I'm used to. Is there information around that shows how to efficiently get the LINQ results into a datatable or dataset?
TIA
Jeev
All-Star
24182 Points
3719 Posts
Re: Getting LINQ results from SQL db into dataset
May 08, 2008 02:09 PM|LINK
You can create a datatable from the result...See post below
http://blogs.msdn.com/erickt/archive/2007/08/24/linq-to-dataset-data-binding.aspx
see the portion titled "BYOC"
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
If you get the answer to your question, please mark it as the answer.
Ken Tucker
All-Star
16797 Points
2608 Posts
MVP
Re: Getting LINQ results from SQL db into dataset
May 08, 2008 02:16 PM|LINK
There is a CopyToDataTable method of the linq query
http://msdn.microsoft.com/en-us/library/bb396189.aspx
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=3266781&SiteID=1Space Coast .Net User Group