G
Guest
I created a typed dataset from which I am trying to access the data. When I use the following code to access a row
string name =dataset.person[1].firstName
I receive an error System.IndexOutOfRangeException as if there are no rows. Yet when I dump the data to a file I receive (sample of file)
<?xml version="1.0" standalone="yes"?><Dataset1 xmlns="http://tempuri.org/Dataset1.xsd"><Table><accountNo>1</accountNo><firstName>John </firstName><lastName>Smith </lastName><middleInitial></middleInitial></Table><Table><accountNo>2</accountNo><firstName>Michael </firstName><lastName>Kimson </lastName></Table><Table><accountNo>3</accountNo><firstName>Lewis </firstName
What am I doing wrong. How should I access the Rows of data in the dataset. I also tried to loop through the rows with a foreach loop but apparently there is no enumerator for this class
string name =dataset.person[1].firstName
I receive an error System.IndexOutOfRangeException as if there are no rows. Yet when I dump the data to a file I receive (sample of file)
<?xml version="1.0" standalone="yes"?><Dataset1 xmlns="http://tempuri.org/Dataset1.xsd"><Table><accountNo>1</accountNo><firstName>John </firstName><lastName>Smith </lastName><middleInitial></middleInitial></Table><Table><accountNo>2</accountNo><firstName>Michael </firstName><lastName>Kimson </lastName></Table><Table><accountNo>3</accountNo><firstName>Lewis </firstName
What am I doing wrong. How should I access the Rows of data in the dataset. I also tried to loop through the rows with a foreach loop but apparently there is no enumerator for this class