public List <StudentClass> FetchAndBindStudentDataByStudentId(int StudentId) { List <StudentClass> StudentInfo = new List <StudentClass>(); using (SqlCommand cmd = new SqlCommand("FetchStudentData", Db.DbConnect())) { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@id", StudentId); SqlDataReader rdr = cmd.ExecuteReader(); while (rdr.Read()) { StudentClass student = new StudentClass(); student.FullName = rdr["first_name"].ToString() + " " + rdr["last_name"].ToString(); student.DeptName = student.FetchDeptById(rdr["dept_id"].ToString()); student.AvatarPath = rdr["avatar"].ToString(); StudentInfo.Add(student); } } return(StudentInfo); }