Data relations and data set
-
Hi, I'm facing a problem to fetch data rows from a child table using data set and xml file , using VS2005 and created the data set and tables using the wizard. Please consider the following scenario: TABLE1 - InstalledProgramInfo - Name [string , Key] - UninstallSequenceNumber [int] TABLE2 - AdditionalBackupInfo - Name [string , Key] - Source [string , Key] - Destination [string , Key] Relation - InstalledProgramInfo_AdditionalBackupInfo (Name -> Name) , Relation type (one to many). The XML file content is as follow:
<InstalledProgramInfo>
<Name>AAA<</Name>
<UninstallSequenceNumber>0</UninstallSequenceNumber>
<AdditionalBackupInfo>
<Name>AAA</Name>
<Source>C:\SourceTest</Source>
<Destination>C:\DestTest</Destination>
</AdditionalBackupInfo>
<AdditionalBackupInfo>
<Name>AAA</Name>
<Source>C:\SourceTest1</Source>
<Destination>C:\DestTest1</Destination>
</AdditionalBackupInfo>
</InstalledProgramInfo>The code is as follow (The name of the data set is AppConfigurationDataSet):
AppConfigurationDataSet DataSet = new AppConfigurationDataSet();
DataSet.ReadXml("AppConfiguration.xml");
InstalledProgramInfoDataTable Table = (InstalledProgramInfoDataTable)DataSet.Tables["InstalledProgramInfo"];
foreach(InstalledProgramInfoDataRow CurrentRow in Table.Rows)
{
foreach(DataRow NestedRow in CurrentRow.GetChildRows("InstalledProgramInfo_AdditionalBackupInfo"))
{
DoSomething(); // I can't reach this code(the relation exist in CurrentRow!!!)
}
}Anyone? With best regards, Eli