public void PopulateStudentName() { AbcDAL MyDAL = new AbcDAL(""); DataTable ResultTable = MyDAL.SelectStudentByAuthID(1); string StudentID = ResultTable.Rows[0]["StudentID"].ToString().Trim(); RLStudentName.Text = ResultTable.Rows[0]["StudentName"].ToString(); DataTable ResultTableClass = MyDAL.PopulateClassByStudentIDSubjectID(StudentID, RCBSubject.SelectedValue.ToString().Trim()); if (ResultTableClass.Rows.Count != 0) { RLGrade.Text = ResultTableClass.Rows[0]["Grade"].ToString(); RLAttendance.Text = ResultTableClass.Rows[0]["Attendance"].ToString().Trim(); } else { RLGrade.Text = "No record yet"; RLAttendance.Text = "No record yet"; } }