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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T01:18:47+00:00 2026-05-12T01:18:47+00:00

How do you take a couple of data tables and put them in a

  • 0

How do you take a couple of data tables and put them in a dataset and relate (that doesn’t even sound like correct English) them?

I know how to create datatables.

  • 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-05-12T01:18:47+00:00Added an answer on May 12, 2026 at 1:18 am

    Here is an example from one of my classes

    // create the relationship between Booking and Booking_MNI
    DataRelation relBookingMNI;                         
    relBookingMNI = new DataRelation("BookingToBookingMNI",dsBooking.Tables["Booking"].Columns["Record_Id"],dsBooking.Tables["Booking_MNI"].Columns["booking_record_id"]);
    dsBooking.Relations.Add(relBookingMNI);
    

    dsBooking is my main dataset that contains 2 tables Booking and Booking_MNI
    Where the Record_Id is the primary key and booking_record_id is the foreign key

    I changed the code below to match my first example. But I think this is what you are looking for. In our production code this will produce the plus “+” symbol to the left of the row which would allow you to drill into the related table. Again I took production code and made it look like the first example so I don’t know if it will compile but it should get you going in the right direction.

    DataTable dtBooking = ds.Tables[0];
    DataTable dtBooking_MNI = ds.Tables[1];
    
    dtBooking.PrimaryKey = new DataColumn[] {dtBooking.Columns["Record_Id"]};
    dtBooking_MNI.PrimaryKey = new DataColumn[] {dtBooking_MNI.Columns["booking_Record_Id"]};
    
    /* Setup DataRelation between the DataTables */
    DataColumn[] dcBookingColsArray = new DataColumn[1] {dtBooking.Columns["Record_Id"]};
    DataColumn[] dcBookingMNIColsArray = new DataColumn[1] {dtBooking_MNI.Columns["booking_record_Id"]};
    
    DataRelation relBooking_To_MNI = new DataRelation("Booking_To_MNI",dcBookingColsArray,dcBookingMNIColsArray);
    ds.Relations.Add(relBooking_To_MNI_Units);
    
    // grid where you want to display the relationship
    grdBooking.DataSource = ds;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a couple of LINQ to SQL queries that I feel take a
I have a couple of queries for a web site that take a long
I have a couple of tables in MySQL that I'm working with that do
I have a couple of clients that want to take credit card details on
I've seen a couple of iPhone applications that have the functionality to export data
Take an input field like this : ​<input type='number' step='1' />​​​​​​​​​​​​​​​​​ In Chrome, you
I have an object that can take anywhere from a split second to a
I have IOC from Ninject in my app. There are a couple classes that
I've got several web-services: asmx,wcf. At couple of them there are some methods, which
I wonder if anyone can help? After Google announced that it will take note

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.