locked
C# - Join SourceType resultset to TableAdapter? RRS feed

  • Question

  • Anyone 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
    Saturday, May 30, 2009 9:09 PM

Answers

  • Can't you do it with a LINQ statement instead?

    • Marked as answer by Heatmizuh Sunday, May 31, 2009 6:58 PM
    Sunday, May 31, 2009 4:47 AM

All replies

  • Can't you do it with a LINQ statement instead?

    • Marked as answer by Heatmizuh Sunday, May 31, 2009 6:58 PM
    Sunday, May 31, 2009 4:47 AM
  • Yeah, 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
    Sunday, May 31, 2009 6:59 PM