private void updateMultipleGPA() { sql_con.Open(); foreach (DataGridViewRow r in dataGridView1.Rows) { editStudent es = new MyGPA.editStudent((String)r.Cells["lastName"].Value, (String)r.Cells["firstName"].Value); es.updateGPA(); es.Close(); } sql_con.Close(); }
private void editStudent_Click(object sender, EventArgs e) { if (Application.OpenForms.OfType <editStudent>().Count() == 0) { sql_con.Open(); if (dataGridView1.SelectedRows.Count == 1) { DataGridViewRow r = dataGridView1.SelectedRows[0]; editStudent es = new MyGPA.editStudent((String)r.Cells["lastName"].Value, (String)r.Cells["firstName"].Value); es.Show(); } else { MessageBox.Show("Please select 1 student", "ERROR"); } sql_con.Close(); } }