C# - Join SourceType resultset to TableAdapter?
-
2009. május 30. 21:09Anyone give me a hand here? I'm doing a PhoneBook SourceType query and I want to do left outer join on the resultset to a datatable based on PhoneNumber and be left with a single dataset I can present in a grid to the end-user.
The results from the Live Search is basically a collection (as I'm sure most of you know) -- but I was looking for a way to create a DataRelation between the search resultset and a datatable. Anyone know how to do this?
The way I was thinking of is: Create a new datatable in memory and copy the results from the search then do the datarelation from this memory table to my SQL populated datatable..
But, I'd rather not go through that interim step if possible, having to loop through each result and creating a new table.
Is there any easy way to copy or clone the search results to a datatable? Or a way to directly establish a datarelation or join between the search results and an existing datatable?
Thanks!
Heat
Az összes válasz
-
2009. május 31. 4:47Tulajdonos
Can't you do it with a LINQ statement instead?
- Megjelölte válaszként: Heatmizuh 2009. május 31. 18:58
-
2009. május 31. 18:59Yeah, I got it working in LINQ. Although, left outer joins in LINQ aren't exactly straightforward. Took a bit of digging, and it still looks a little hacky. But it works.
Thanks!
Heat