private void DisplayMarks_Click(object sender, EventArgs e) { try { DataTable dta = repository.DisplayStudentMarks(student.StudentId); dataGridView1.DataSource = dta; } catch (Exception exc) { Console.WriteLine(exc); } }