Author: rkeslar | Posted on: 12/11/2009 3:38:39 PM | Views : 360

 
I'm having trouble figuring out why my loop isn't working. This is my code:
splitPivotBreaks.Count = 146
On the first time through my loop, CurBreakVal = 1066 and it's added to the DataTable.  On the next 5 iterations, CurBreakVal and PrevBreakVal are both 1066 so they are not added. On the 7th iteration, CurBreakVal = 1067 and should be added to the DataTable, but this is when the error occurs. Can you see what I might be doing wrong?  Thanks


string PrevBreakVal = string.Empty; string CurBreakVal = string.Empty; for (int j = 1; j < splitPivotBreaks.Count; j++) { CurBreakVal = splitPivotBreaks[j].ToString(); if (CurBreakVal != PrevBreakVal) { PivotDataTable.Rows.Add(CurBreakVal[j]); } PrevBreakVal = CurBreakVal; } M ...

Go to the complete details ...