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

  • SEARCH
  • Home
  • 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 8582795
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T21:23:00+00:00 2026-06-11T21:23:00+00:00

I have two DataTables in an ASP.NET application written in C# (dtA and dtB).

  • 0

I have two DataTables in an ASP.NET application written in C# (dtA and dtB). The both get filled from textboxes from user input. Each of them will only have one datarow at a time. For example, dtA can have the following values [ABC, DEF] where the column names are first name and last name, and dtB can having the following values [50, 100, 95] where the column names are grades. I need to know how to combine the two of these tables into a new datatable called dtC this way I can return dtC.

  • 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-11T21:23:01+00:00Added an answer on June 11, 2026 at 9:23 pm

    Something like:

            var dtC = new DataTable("CombinationOfBoth");
            dtC.Columns.Add("Firstname",typeof(string));
            dtC.Columns.Add("Lastname", typeof (string));
            dtC.Columns.Add("Grade1", typeof (int));
            dtC.Columns.Add("Grade2", typeof(int));
            dtC.Columns.Add("Grade3", typeof(int));
    
            dtC.Merge(dtA,false,MissingSchemaAction.Ignore);
            dtC.Merge(dtB, false, MissingSchemaAction.Ignore);
    

    Please note that the dtA should have same column names as “Firstname”, and “LastName”, also dtB should have “Grade1″,”Grade2″,”Grade3”

    or you can change the name of the columns on the dtC to be exactly same as the ones that are on dtA and dtB

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

Sidebar

Related Questions

I have two Databases. They are both filled into DataTables using the GetTable1 \
I have an asp.net c# web application where a user can log in and
I have two datatables and I need to match zipcodes from each of the
Suppose I have two .NET DataTables populated as follows, where ID is the primary
i have windows application in which i am constructing dataset with two datatables one
I have asp:datalist binding from table this table contain two columns one of them
I have a report that needs to get data from two logical areas of
Summary We have an ASP.NET application that allows users to query a SQL Server
I am making application in ASP.Net 2.0 in VS 2010, i have created crystal
I have two dataTables as follows 1) dtExistingZipCodeInDB (data from database) 2) dtCSVExcelSource (data

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.