• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 428
  • Last Modified:

Linq to sql convery results to typed dataset

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
TrialUser
Asked:
TrialUser
4 Solutions
 
ExempoCommented:
You can use the CopyToDataTable function.
Here is an article that describes it.
http://msdn.microsoft.com/en-us/library/bb396189.aspx
0
 
naspinskiCommented:
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
 
vivekpv10Commented:
0
 
TrialUserAuthor Commented:
thanks
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now