Reading rows out a dataset

J

jed

Hello what i have done here is read an xml file into a untyped
dataset. the values i can see in a datagrid but how would i gain
access to these rows, they are in a txt format in the dataset.
Here are some of the xml values
DayNumber="0" First="2964" Last="1">
<Value Index="0">- 3.8 mA</Value>
<Value Index="1">- 3.8 mA</Value>
<Value Index="2">- 3.8 mA</Value>
<Value Index="3">- 3.8 mA</Value>
<Value Index="4">- 3.8 mA</Value>
<Value Index="5">- 3.8 mA</Value>
<Value Index="6">- 3.8 mA</Value>
<Value Index="7">- 3.8 mA</Value>
<Value Index="8">- 3.8 mA</Value>
<Value Index="9">- 3.8 mA</Value>
Here is the code:
public Form1()
{
InitializeComponent();
string xml = "C:\\WirelessXML.xml";

dataSet1.ReadXml(xml);
}

private void button1_Click(object sender, EventArgs e)
{
dataGridView1.DataSource = dataSet1;
dataGridView1.DataMember = "Value";

}
How do i find out what the tablename is and how do i obtain the data
in the rows and be able to work with it please help.thanks
 
M

Morten Wennevik [C# MVP]

Hello what i have done here is read an xml file into a untyped
dataset. the values i can see in a datagrid but how would i gain
access to these rows, they are in a txt format in the dataset.
Here are some of the xml values
DayNumber="0" First="2964" Last="1">
<Value Index="0">- 3.8 mA</Value>
<Value Index="1">- 3.8 mA</Value>
<Value Index="2">- 3.8 mA</Value>
<Value Index="3">- 3.8 mA</Value>
<Value Index="4">- 3.8 mA</Value>
<Value Index="5">- 3.8 mA</Value>
<Value Index="6">- 3.8 mA</Value>
<Value Index="7">- 3.8 mA</Value>
<Value Index="8">- 3.8 mA</Value>
<Value Index="9">- 3.8 mA</Value>
Here is the code:
public Form1()
{
InitializeComponent();
string xml = "C:\\WirelessXML.xml";

dataSet1.ReadXml(xml);
}

private void button1_Click(object sender, EventArgs e)
{
dataGridView1.DataSource = dataSet1;
dataGridView1.DataMember = "Value";

}
How do i find out what the tablename is and how do i obtain the data
in the rows and be able to work with it please help.thanks

Hi,

You don't need the tablename to access the rows as you can just use DataSet.Tables[0].Rows. The TableName is accessible the same way DataSet.Tables[0].TableName.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top