Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Loop through xml dataset 1

Status
Not open for further replies.

spangeman

Programmer
Oct 16, 2004
96
EU
Hello there.

I'm trying to learn about C# (I'm currently a VB6 developer. I have done a few tutorials and am now experimenting with my own application to play with XML in VS.net.

I had a go with this tutorial as a starting point:-


Which basically amounts to doing this:-

string filePath = "C:\\_Data_Transfers\\CFRMIS Data Import Tool\\CFRMIS Data Import Tool\\transferSettings.xml";
dsfiles.ReadXml(filePath);
DG1.DataSource = dsfiles;
DG1.DataMember = "files";
DG1.CaptionText = DG1.DataMember;

DG1 being a datagrid to display the XML data.

What I want to do now is loop throug the data in the dataset and I have no idea how to do this.

To start off with I'd like to write a loop which loops through each record in the dataset and message boxes it to the screen.

Can you help?


Cheers
Spangeman
 
I'm guessing that dsfiles is a DataSet?

You could run a for loop like this:
Code:
for(int i = 0; i < dsfiles.Tables["files"].Rows.Count; i++){
   dsfiles.Tables["files"].Rows[i]["column name"].ToString();
}

You would need to plug in your column instead of "column name"].
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top