Solved

Linq to sql convery results to typed dataset

Posted on 2010-09-23
5
413 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
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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Suggested Solutions

Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

813 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now