Dim _tableBackLogs As System.Data.DataTable
Do While i - 2 > 0
_tableBackLogs = Global.DataAccess.GetDataTable("SELECT SubjectID,SubjectName,Grade FROM SubjectPI WHERE RegNo='" & CInt(HttpContext.Current.Session("userName")) & "' AND Status='Fail' AND Semester='" & i - 2 & "'")
i = i - 2
Loop
Doing this replaces the previous data in the DataTable. I want to retain the previous data i.e i want the new rows to be added to the DataTable w/o replacing the previous rows.
Replace your code with following.