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 8710479
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T04:38:09+00:00 2026-06-13T04:38:09+00:00

In my project there are two datatables dtNames and dtDetails . I dont know

  • 0

In my project there are two datatables dtNames and dtDetails.

I dont know about SQL. Here I am connecting to XML and Textfiles.

dtNames

EmpName    EmpRole

   a         2
   b         3
   c         4

dtDetails

 Empid     EmpName   EmpCity   EmpRole

  101        a         abc       3  //EmpRole not equal to above table EmpRole
  102        b         abc       3
  103        c         xyz       4
  104        d         pqr       5
  105        e         rst       6

I want to relate these two datatables based on the EmpName and EmpRole (here comparing to dtNames) and store the result in a DataSet dsMain(table from dtDetails) and then divide the two datatables in according to comparison like matchedDataTable and unmatchedDataTable.

I know this can be done using DataRelation or RowFilter but i cant get a thought how to do this because there are two columns to be compared with other datatable two columns which i dont know.(I am beginner in .net)

I tried the below code: (not working)

            DataSet dsMain = new DataSet();
            DataRelation newRelation = new DataRelation("processData"
                , dtNames.Columns["EmpName"], dtDetails.Columns["EmpName"]);
            dsMain.Relations.Add(newRelation);

As you can see In the above code I am just comparing one column with other column. How compare with two. I am very close

please assist.

  • 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-13T04:38:11+00:00Added an answer on June 13, 2026 at 4:38 am

    Use the constructor that accepts column arrays:

    DataSet dsMain = new DataSet();
    DataRelation newRelation = new DataRelation("processData",
        new DataColumn[] { dtNames.Columns["EmpName"], dtNames.Columns["EmpRole"] },
        new DataColumn[] {dtDetails.Columns["EmpName"], dtDetails.Columns["EmpRole"]}
    );
    dsMain.Relations.Add(newRelation);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working on a project where there are two sets of XML schema-generated objects
There are two project in which I collaborate, they live in different servers, A
There are two projects: 1) applet project that outputs jar file 2) web app
In my project, there are two view controllers - let's say firstViewController and secondViewController.
I'm using Hudson to build my project from my Mercurial repository. There are two
In virtually every project I've ever worked on, there will be one or two
In my project there is a listview which contains textview and checkbox..Here is my
In my project there is a Form mainForm in which there are two textBoxes
I'm using Visual Studio 2010, and in my C++/CLI project there are two Code
I have a project in C# where there are two namespaces defined in seperate

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.