Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Data relations and data set

Data relations and data set

Scheduled Pinned Locked Moved C#
xmlhelpquestion
1 Posts 1 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • E Offline
    E Offline
    eli15021979
    wrote on last edited by
    #1

    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

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups