Hi I'm sorry I am a beginner at C# programming and although I know a lot of threads has been created on this issue, I can't seem to find one that is applicable to my case especially since I already applied this on other forms and it worked.
This solution tells me iterate it backwards, however I don't know how/where to apply it. I am getting the error at the in in
foreach (DataRow dataRow_AvailableEmp in AvailableEmp_dataTable.Rows)
here's the rest of the code.
if (WithTasks_Datatable.Rows.Count > 0)
{
foreach (DataRow dataRow_WithTask in WithTasks_Datatable.Rows)
{
Booked_Initial = dataRow_WithTask["Assigned"].ToString();
if (this_Initial != Booked_Initial) //di booked
{
//CHECK IF IN DATATABLE
if (AvailableEmp_dataTable.Rows.Count > 0)
{
foreach (DataRow dataRow_AvailableEmp in AvailableEmp_dataTable.Rows)
{
Available_Initial = dataRow_AvailableEmp["EmpID"].ToString();
if (this_Initial != Available_Initial) //NOT IN DB
{
//ADD
AvailableEmp_dataTable.Rows.Add(this_EmpID, this_Initial, PositionName, TeamName, TeamLead);
}
}
}
else
{
//ADD
AvailableEmp_dataTable.Rows.Add(this_EmpID, this_Initial, PositionName, TeamName, TeamLead);
}
}
}
}