XML and dataset question

Hi all,

I've posted this already on the VB express forum, but I didn't get an answer. This might be a better forum for my question:

I've created a DataSet and use xml-files as my database.

The principle is outlined in this article:

http://www.devx.com/dotnet/Article/28678

So for every DataTable I have an XML-file containing the data for that table.

If the dataset contains a lot of tables I also get a lot of XML-files that way.

I've found examples of reading/writing the complete dataset in one file and reading/writing datatables on a per file basis. Now I wonder: Is it possible to store multiple tables of a DataSet in one XML file

E.g. Store the large data tables in seperate files and store the small tables in one file All members of the same dataset.



Answer this question

XML and dataset question

  • David Oyster

    Yes, I thought of that too.

    The only disadvantage in this scenario is as the application grows and I want to add more tables to the datasets it's harder to maintain an overview of the relations between all the tables. I don't know of a way to define a relation between a table in dataset1 and a table in dataset2.

    So I prefer to use one dataset.

    If that isn't possible I will adopt this solution I think.


  • DaveS_

    I do not know of any direct ways to do this using overloads of WriteXml.

    What you could do instead is create as many datasets as you need files andcopy only the relevant tables to each of these datasets.

    For example;

    DataSet large = new DataSet();

    large.Tables.Add(ds.Tables[0]);//Add large table from ds

    large.WriteXml(fileName);

    large=null;

    and so on



  • XML and dataset question