private void Insert(object sender, EventArgs e) { cmd = new SqlCommand("UPDATE Registration SET AdmissionFeeAmount='" + this.AdmissionAmount.Text + "',MonthlyFeeAmount='" + this.MonthlyAmount.Text + "',CertificateFeeAmount='" + this.CertificateAmount.Text + "',ExaminationFeeAmount='" + this.ExaminationAmount.Text + "',TotalFeeAmount='" + total + "' WHERE [GR.No] = '" + int.Parse(tempForGRno) + "'", con); try { con.Open(); dr = cmd.ExecuteReader(); MessageBox.Show("Saved"); while (dr.Read()) { } AdmissionAmount.Clear(); MonthlyAmount.Clear(); CertificateAmount.Clear(); ExaminationAmount.Clear(); new FormA().Show(); this.Hide(); } catch (Exception ex) { MessageBox.Show(ex.Message); con.Close(); } }
private void Insert(object sender, EventArgs e) { cmd = new SqlCommand("INSERT INTO FeeStructure (AdmissionFeeAmount,MonthlyFeeAmount,CertifucateFeeAmount,ExaminationFeeAmount,TotalFeeAmount) VALUES ('" + this.AdmissionAmount.Text + "','" + this.MonthlyAmount.Text + "','" + this.CertificateAmount.Text + "','" + this.ExaminationAmount.Text + "','" + this.TotalAmount.Text + "')", con); try { con.Open(); dr = cmd.ExecuteReader(); MessageBox.Show("Saved"); while (dr.Read()) { } } catch (Exception ex) { MessageBox.Show(ex.Message); } AdmissionAmount.Clear(); MonthlyAmount.Clear(); CertificateAmount.Clear(); ExaminationAmount.Clear(); TotalAmount.Clear(); }