private void butBusFee_Click(object sender, EventArgs e) { string newadno = ""; string newstdno = ""; SqlDataAdapter da = new SqlDataAdapter("Select adno,cstandard from tbl_student where adno='" + adno + "' and cstandard='" + stdno + "'", d.con); DataSet ds = new DataSet(); da.Fill(ds); DataRow dr; if (ds.Tables[0].Rows.Count >= 1) { dr = ds.Tables[0].Rows[0]; newadno = dr[0].ToString(); newstdno = dr[1].ToString(); Buspayment busfair = new Buspayment(); SchoolManagement.rno = newadno; SchoolManagement.standard = newstdno; busfair.Show(); } else { MessageBox.Show("Please select any one of the student", "Warning..", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
private void dgvsview_CellClick(object sender, DataGridViewCellEventArgs e) { adno = dgvsview.Rows[e.RowIndex].Cells[0].Value.ToString(); ptnum = dgvsview.Rows[e.RowIndex].Cells[1].Value.ToString(); SchoolManagement.rno = adno; SchoolManagement.ptnum = ptnum; Buspayment p = new Buspayment(); p.Show(); this.Hide(); }