Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Joining 2 DataSets

Joining 2 DataSets

Scheduled Pinned Locked Moved C#
wcfcsharpasp-netwpfcom
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    RickSharp
    wrote on last edited by
    #1

    Hello all, I have 2 datasets from 2 different Web Services and reading them into DataSets: DataSet dsLoans = new DataSet(); dsLoans.ReadXml(XmlReader.Create(new StringReader(myWLSreference.GetCustomLoanExport2()))); DataSet dsCompany = new DataSet(); dsCompany.ReadXml(XmlReader.Create(new StringReader(myWLSreference.GetCustomCompanyExport2()))); I have done multiple searches and have come across: http://forums.asp.net/t/1708173.aspx/1?how+can+i+inner+join+tables+within+DATASET+[^] http://stackoverflow.com/questions/10502512/c-sharp-datatable-inner-join-with-dynamic-columns?lq=1[^] http://support.microsoft.com/kb/326080/en-us[^] But no joy yet. I have searched and searched. I cant use Datatables because i'm reading the dataset into a List<> with a foreach statement like so:

    foreach (DataRow row in JoinedDataSet.Tables["Loan"].Rows)
    {

           WireEntryLoan newEntryLoan = new WireEntryLoan();
    
           newEntryLoan.custName = row\["MtgeeLoanName"\].ToString();
           newEntryLoan.loanWLSID = row\["LoanNumber"\].ToString();
    

    Then binding that to GridView. How in the world can I join 2 DataSets on a common field?!

    H 1 Reply Last reply
    0
    • R RickSharp

      Hello all, I have 2 datasets from 2 different Web Services and reading them into DataSets: DataSet dsLoans = new DataSet(); dsLoans.ReadXml(XmlReader.Create(new StringReader(myWLSreference.GetCustomLoanExport2()))); DataSet dsCompany = new DataSet(); dsCompany.ReadXml(XmlReader.Create(new StringReader(myWLSreference.GetCustomCompanyExport2()))); I have done multiple searches and have come across: http://forums.asp.net/t/1708173.aspx/1?how+can+i+inner+join+tables+within+DATASET+[^] http://stackoverflow.com/questions/10502512/c-sharp-datatable-inner-join-with-dynamic-columns?lq=1[^] http://support.microsoft.com/kb/326080/en-us[^] But no joy yet. I have searched and searched. I cant use Datatables because i'm reading the dataset into a List<> with a foreach statement like so:

      foreach (DataRow row in JoinedDataSet.Tables["Loan"].Rows)
      {

             WireEntryLoan newEntryLoan = new WireEntryLoan();
      
             newEntryLoan.custName = row\["MtgeeLoanName"\].ToString();
             newEntryLoan.loanWLSID = row\["LoanNumber"\].ToString();
      

      Then binding that to GridView. How in the world can I join 2 DataSets on a common field?!

      H Offline
      H Offline
      HuorSwords
      wrote on last edited by
      #2

      It is only an option, but... You may need to create a third dataset which the relationship itself is defined, and feed it with the information you get from these two webservices. After that, you still can iterate through this third dataset to fill your gridview.

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups