Create One DataTable from Many within a DataSet (C# + XML)

364 Views Asked by At

I'm attempting to ingest multi-layered XML data from an API in order to insert it into a database.

Firstly, once I've pulled the XML file from the API, I'm using DataSet's ReadXML method to create DataTables. There happens to be 19 in total within the DataSet once ingested.

I understand that I can use DataRelation to link all of the tables, but it looks like the ReadXML method has already inferred some schema info and thus generated what appear to be sensible relationships between each DataTable of the DataSet.

However, I'd like to end up with just one table to port into my database, not 19, and I'd prefer to join/merge/relate the tables in C#, instead of within SQL.

Can you advise on a best practice for creating a single table from all related DataTables within my current DataSet?

0

There are 0 best solutions below