Hi Guys
Really sorry to trouble you all but I could really use some help on this.
I am currently learning from a book about database programming in c#. I have loaded the data into my dataset etc.
just for example data set is.....
PersonName Age
John 34
James 23
Simon 45
Peter 15
Using the above example dataset how does the following code work step-by-step in each stage.
foreach (DataRow dRow in dt.Rows)
{
foreach (DataColumn datacol in dt.Columns)
Console.WriteLine(dRow[datacol]);
Console.WriteLine("================");
}
How does the loop work in each stage?? How is a for loop different to a foreach loop?
If I can see step by step then I will be able to understand.
Any help would be amazing. Sorry If this question is very simple for you professionals. I guess we all have to start from somewhere.
As I said I would appreciate as much help as possible.
Cheers
Really sorry to trouble you all but I could really use some help on this.
I am currently learning from a book about database programming in c#. I have loaded the data into my dataset etc.
just for example data set is.....
PersonName Age
John 34
James 23
Simon 45
Peter 15
Using the above example dataset how does the following code work step-by-step in each stage.
foreach (DataRow dRow in dt.Rows)
{
foreach (DataColumn datacol in dt.Columns)
Console.WriteLine(dRow[datacol]);
Console.WriteLine("================");
}
How does the loop work in each stage?? How is a for loop different to a foreach loop?
If I can see step by step then I will be able to understand.
Any help would be amazing. Sorry If this question is very simple for you professionals. I guess we all have to start from somewhere.
As I said I would appreciate as much help as possible.
Cheers