The problem is that I have an XML file that needs to put data into 2 seperate tables one is testing and the other is unit. they need to link to each other, every unit has to have a testing records, testing can have more than one units.
How can I make it so this goes into the testing table as
No unit number is given, but this must link back to the testing record. Please help. all the stuff i have is below. Thanks.
Sample XML
Here is what I currently have (this works to pull in all the main parts of the records
David Kuhn
------------------
How can I make it so this goes into the testing table as
Code:
number | UnitNum
82739 | 1
No unit number is given, but this must link back to the testing record. Please help. all the stuff i have is below. Thanks.
Sample XML
Code:
<testing>
<number>82739</number>
<unit>
<price>83.74</price>
<location>San Diego</location>
<ready>Y</ready>
</unit>
</testing>
Here is what I currently have (this works to pull in all the main parts of the records
Code:
protected void Page_Load(object sender, EventArgs e)
{
XmlReaderSettings settings = new XmlReaderSettings();
//Change the settings in the XML Reader
settings.IgnoreWhitespace = true;
settings.IgnoreComments = true;
//path of file
string filePath = "C:\\Data\\";
DataSet myDS = new DataSet();
DataTable myTable = new DataTable("testing");
myTable.Columns.Add("number", typeof(string));
myTable.Columns.Add("UnitNum", typeof(int));
//Add the table to the dataset
myDS.Tables.Add(myTable);
//combine the path and filename of the XML File
string cartsFile = Path.Combine(filePath, "15recordsInXML.xml");
using (XmlReader reader = XmlReader.Create(cartsFile, settings))
{
myDS.ReadXml(reader);
GridView1.DataSource = myDS;
GridView1.DataBind();
}
}
David Kuhn
------------------