Solved

Linq to sql convery results to typed dataset

Posted on 2010-09-23
5
416 Views
Last Modified: 2013-11-11
After I execute the linq query and get the results, is it possible to convert the result set to a typed dataset?
for eg. the code i have is:
   Dim ItemInfo = _
    From Items In dataContext.Items _
    Where Items.ItemNmbr = txtItem.Text.Trim _
    Select Items

I want to convert iteminfo to something like
dim dtitem as new dsItem.dtItemDatatable
then convert iteminfo to type dtItem
0
Comment
Question by:TrialUser
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 3

Accepted Solution

by:
Exempo earned 125 total points
ID: 33746474
You can use the CopyToDataTable function.
Here is an article that describes it.
http://msdn.microsoft.com/en-us/library/bb396189.aspx
0
 
LVL 21

Assisted Solution

by:naspinski
naspinski earned 125 total points
ID: 33749235
you could directly cast the items into the type you want them to be, then the query output would be IEnumerable<whateverTypeYouWant>:
Dim ItemInfo = _
    From Items In dataContext.Items _
    Where Items.ItemNmbr = txtItem.Text.Trim _
    Select new SomeClass() { name = Items.name }
//not sure how that works in VB...

Open in new window

0
 
LVL 5

Assisted Solution

by:vivekpv10
vivekpv10 earned 250 total points
ID: 33750917
0
 
LVL 5

Assisted Solution

by:vivekpv10
vivekpv10 earned 250 total points
ID: 33778750
0
 

Author Closing Comment

by:TrialUser
ID: 33795013
thanks
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question