[c#] C#, Looping through dataset and show each record from a dataset column

In C#, I'm trying to loop through my dataset to show data from each row from a specific column. I want the get each date under the column name "TaskStart" and display it on a report, but its just shows the date from the first row for all rows can anybody help?

 foreach (DataTable table in ds.Tables)
 {

     foreach (DataRow dr in table.Rows)
     {
         DateTime TaskStart = DateTime.Parse(
             ds.Tables[0].Rows[0]["TaskStart"].ToString());
         TaskStart.ToString("dd-MMMM-yyyy");
         rpt.SetParameterValue("TaskStartDate", TaskStart);
     }
 }

This question is related to c# foreach dataset

The answer is


DateTime TaskStart = DateTime.Parse(dr["TaskStart"].ToString());

foreach (DataRow dr in ds.Tables[0].Rows)
{
    //your code here
}

foreach (DataTable table in ds.Tables)
{
    foreach (DataRow dr in table.Rows)
    {
        var ParentId=dr["ParentId"].ToString();
    }
}

I believe you intended it more this way:

foreach (DataTable table in ds.Tables)
{
    foreach (DataRow dr in table.Rows)
    {
        DateTime TaskStart = DateTime.Parse(dr["TaskStart"].ToString());
        TaskStart.ToString("dd-MMMM-yyyy");
        rpt.SetParameterValue("TaskStartDate", TaskStart);
    }
}

You always accessed your first row in your dataset.