Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8320761
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T22:46:13+00:00 2026-06-08T22:46:13+00:00

I have 2 Datasets with 1 table (7 cols) in each. Both the tables

  • 0

I have 2 Datasets with 1 table (7 cols) in each. Both the tables have different column names, but same structure. I want to join/combine/merge these 2 tables and produce a single table with 7 cols only. I treid with Merge, but that produces 14 cols & doesn’t actually join both of them.
I searched in this site and others too, but couldn’t find any appropriate solution for my case. My code is :

    Private Sub FillMatchToOtstdAdapter()
    Dim sql1 As String = "SELECT DOCMCH.docmch_nAccNo, DOCMCH.docmch_lRefDocId, DOCMCH.docmch_nDocLnNo, DOCMCH.docmch_dAdjustedAmt, DOCMCH.docmch_dAdjustedAmt, DOCHDR.dochdr_nVersionNo, 'D' AS Expr1 FROM TXNTYP INNER JOIN (DOCHDR INNER JOIN DOCMCH ON DOCHDR.dochdr_lDocId = DOCMCH.docmch_lRefDocId) ON TXNTYP.txntyp_sDocTyp = DOCHDR.dochdr_sDocType WHERE (((TXNTYP.txntyp_cDocTypCat)='F') AND ((DOCHDR.dochdr_lDocDt)>=20120630));"
    Dim sql2 As String = "select otstnd_nAccNo, otstnd_lDocId, otstnd_nDocLnNo, otstnd_dOtstndgAmt, otstnd_dDocLnAmt, otstnd_nVersionNo, otstnd_cOtstndgSign from otstnd"

    ' Get Records of Query 1
    ds_otstnd_Adap = New OleDb.OleDbDataAdapter(sql1, connStr)
    ds_otstnd_Adap.Fill(ds_otstnd_Ds)
    ds_otstnd_Dt = ds_otstnd_Ds.Tables(0)

    ' Get Records of Query 2
    Dim adap As New OleDb.OleDbDataAdapter(sql2, connStr)
    Dim ds As New DataSet
    adap.Fill(ds)

    ' Merge both of them
    ds_otstnd_Dt.Merge(ds.Tables(0), False, MissingSchemaAction.Add)
    DataGridView1.DataSource = ds_otstnd_Dt
End Sub

Any idea how do I produce the results in a single table with 7 cols only – just data from 2nd table to be added in 1st table.
I was thinking of picking each Row from table2 and just addin table1, but their may be many rows & don’t want to go in unnecessary process ifthings can be managed in easier and simple manner.

Any help is highly appreciated.

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T22:46:16+00:00Added an answer on June 8, 2026 at 10:46 pm

    I got it. I added ” as Col1″ to both the query’s making same col for the results of each table.
    For merge, replaced MissingSchemaAction.Add to MissingSchemaAction.Ignore.

    This worked out for me.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two datasets each with one data table pulled from different sources and
I'm using table adapters and datasets in .NET (version 2.0). I have two tables
I have 2 tables, a master table and a transaction table. I want to
I'm working with .NET strongly-typed datasets and have a table with a nullable int
I have a dataset with multiple tables. One table in particular has one record
i have a page that displays large datasets into html tables. how can i
I have a report with two separate tables referencing two separate datasets. The first
I have a table that contains sets of sequential datasets, like that: ID set_ID
I have a project which uses strongly typed datasets. Let's assume I want to
I have some demanding mysql queries that have to select same frequently updated datasets

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.