Thanks for the help here. I know I am confused on procedures and terms for
all this. Basically, I want to end up with an XML file similar to the one
shown below. I currently have 2 arrays - one with just the common show data
(showname and showdate) and another array with sets of values for each entry
(name, team, event, time).
From what I've read I believe I want to create a new datatable for each of
those 2 current arrays and define columns as appropriate? But since the
contest data table will have just one row and the entries table will have
many rows I don't see how to build an object from which I can export the XML
I need. I've though of a cross join (right term?) where the output will
consist of rows where the contest data is repeated in each row. That seems
inefficient?
Any pointers are much appreciated
================================================
<contest>
<contestinfo>
<contestname>South Side Contest</contestname>
<contestdate>2004-05-07</contestdate>
</contestinfo>
<entry>
<name>Johnny Jones</name>
<team>Marauders</team>
<event>Relay Race</event>
<time>10:30 AM</time>
</entry>
<entry>
<name>Mary Smith</name>
<team>Marauders</team>
<event>Relay Race</event>
<time>10:30 AM</time>
</entry>
<entry>
<name>Ed Brown</name>
<team>Hot Shots</team>
<event>200 Yd</event>
<time>10:45 AM</time>
</entry>
<entry>
<name>Jack Green</name>
<team>Marauders</team>
<event>200 Yd</event>
<time>10:45 AM</time>
</entry>
</contest>
=============================================
Wayne
William Ryan eMVP said:
Hi Wayne:
What part do you need? I'll try to find something in particular.
if you have a datatab;le, the rest is easy:
DataSet ds = new DataSet();
ds.Tables.Add(DataTableYouCretaed);
ds.WriteXML(@"Path:\Fielname.xml");
then, set up a dataadapter and just call update
dataAdapter1.Update(ds.Tables[0]) //you may need multiple adapters depending
on how many tables you have.
HTH,
Bill
Wayne Wengert said:
William;
Thanks for the reply. Do you have a pointer to information or examples of
how to accomplish this? I am feeling like it is a catch 22 since the only
way I see to get a datatable is to have a dataset to contain it but I have
not yet created the dataset. I am unsure of how to accomplish this.
Wayne
One easy way is to load the data into a datatable instead of arrays, or
use
the arrays to load a datatable. Put the datatable in a dataset and use
the
.WriteXML method to write it and DataSet.ReadXML to read it.
You can also make your Arrays memebers of a class and mark the class as
Serializable and use the serialization libraries to accomplish this.
HTH,
Bill
I am trying to build a VB.NET Windows application in which I want to
create
an XML file from data collected from the user and stored in
arrays.