private void btnSumit_Click(object sender, EventArgs e) { if (txtRollNo.Text == "" || txtAmount.Text == "" || cmbMonth.Text == "") { MessageBox.Show("Something is missing Select Month ,RollNo and fee Amount ", "Alert", MessageBoxButtons.OK, MessageBoxIcon.Hand); } else { try { con = new SqlConnection(c); con.Open(); cmd = new SqlCommand("INSERT into Fees (Id,Month,AmountFee,date)VALUES('" + txtRollNo.Text + "','" + cmbMonth.Text + "','" + txtAmount.Text + "','" + dateTimePicker1.Text + "')", con); cmd.ExecuteNonQuery(); cmd.Parameters.Clear(); cmd2 = new SqlCommand("delete from Defaulters where Id =" + txtRollNo.Text + "", con); cmd2.ExecuteNonQuery(); cmd2.Parameters.Clear(); MessageBox.Show("Data Has Been Save", "S A V E", MessageBoxButtons.OK, MessageBoxIcon.Information); con.Close(); this.Hide(); frmDefaulters m = new frmDefaulters(); m.Show(); } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
private void btnDefaulters_Click(object sender, EventArgs e) { frmDefaulters df = new frmDefaulters(); df.Show(); }