Build Datatable with Type Datatable Columns

I have a task to create a student process where each student has a unique id, but can have multiple classes in different buildings.

This is what i wanted to use, but how do I add data to the Subjects & Building data tables? Also, once populated, how do a read the data from each row & nested row?


Subjects data table:

Buildings Data table:

For each student i get their ID (and add that to the MainStudent data table ), then move in to a different page to get their subjects. At this point i add each of the subjects to the Subjects data table. How do i then merge that subjects table to the mainStudent table & write the main line, then all the subjects?

Following typical Entity-Relationship Modelling approaches we would:

  • define different datatables
  • will bring relations together with key info
  • can use a DataSet to keep all together


Could you tell me how this would this be achieved using code?


You dont need so many tables i believe…you can have one tabe as studentid,subject,building,date

Now when you get the studentid and date dont add to datatable rather store it in a variable for now

And then after each subject and building combination add a row with {namevarible,currentsubject,currentbuilding,datevaraible}

This way if you need deatils of one student you can filter on studentid or name and you will get all the combinations of subjects and buildings

Hope this helps


we recommend to have a quick entry into the topic iteself:

with these concepts it should be possible to find a good strategy on the datadesign and balancing redundancies and table splits.

Once the datamodelling is done, than you can map it to code. from the technicals /options still we recommend to have a closer look on: