[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Linq to sql convery results to typed dataset

Posted on 2010-09-23
5
Medium Priority
?
425 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 500 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 500 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 1000 total points
ID: 33750917
0
 
LVL 5

Assisted Solution

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

Author Closing Comment

by:TrialUser
ID: 33795013
thanks
0

Featured Post

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

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

It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…

650 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