CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Dec 2003
    Posts
    87

    table.select cmd

    I am loading a .xml file to a dataset and them trying to use table.select(<expression>) to query it.

    xml code:

    <Bytes>
    <ID>0</ID>
    <Name>f</Name>
    <Bit>
    <ID>0</ID>
    <Name>g</Name>
    <Number>0</Number>
    <Data>1</Data>
    </Bit>
    <Bit>
    <ID>1</ID>
    <Name>h</Name>
    <Number>0</Number>
    <Data>1</Data>
    </Bit>
    <Bit>
    <ID>2</ID>
    <Name>i</Name>
    <Number>0</Number>
    <Data>1</Data>
    </Bit>
    <Bytes>
    <Bytes>
    <ID>1</ID>
    <Name>f</Name>
    <Bit>
    <ID>0</ID>
    <Name>a</Name>
    <Number>0</Number>
    <Data>1</Data>
    </Bit>
    <Bit>
    <ID>1</ID>
    <Name>b</Name>
    <Number>0</Number>
    <Data>1</Data>
    </Bit>
    <Bit>
    <ID>2</ID>
    <Name>c</Name>
    <Number>0</Number>
    <Data>1</Data>
    </Bit>
    <Bytes>

    Code:
    	
    NewDataSet dss = new NewDataSet();
    string filePath = @"C:\Documents and Settings\matt\My Documents\Visual Studio Projects\TwoWayXML\XMLProject\Tway.xml";
    dss.ReadXml(filePath);
    DataTable dt;
    
    dt = dss.Tables["Bytes"];
    
    DataRow[] dr = dt.Select("ID = 0 AND Bit.ID = 0");
    I want to get the row where Byte ID field that = 0 and it's child Bit ID field that = 0.

    Does anyone know the expression that can do this?

    Thanks

    Matt

  2. #2
    Join Date
    Dec 2003
    Posts
    87

    Re: table.select cmd

    I should have also asked if select() can not do this, what is the best way to navigate through a dataset to obtain specific data in the dataset?

    Is it by iterating through using foreach?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured