Click to See Complete Forum and Search --> : table.select cmd


mrs
March 9th, 2005, 02:34 PM
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>


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

mrs
March 9th, 2005, 05:21 PM
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?