Resources for IT Professionals > Forums Home > Webmaster Forums > Live Search API 2.0 > C# - Join SourceType resultset to TableAdapter?
Ask a questionAsk a question
 

AnswerC# - Join SourceType resultset to TableAdapter?

  • Saturday, May 30, 2009 9:09 PMHeatmizuh Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    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

Answers

  • Sunday, May 31, 2009 4:47 AMAlessCMSFT, OwnerUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer

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

    • Marked As Answer byHeatmizuh Sunday, May 31, 2009 6:58 PM
    •  

All Replies

  • Sunday, May 31, 2009 4:47 AMAlessCMSFT, OwnerUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer

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

    • Marked As Answer byHeatmizuh Sunday, May 31, 2009 6:58 PM
    •  
  • Sunday, May 31, 2009 6:59 PMHeatmizuh Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    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