private void SAVE_Click(object sender, EventArgs e) { if (Salary_ID.Text == "" || Emp_ID.Text == "" || DOJ.Text == "" || DOR.Text == "" || Basic_Pay.Text == "" || Deduction.Text == "" || ESC.Text == "" || Date.Text == "") { MessageBox.Show("PLEASE_FILL_ALL_FIELDS"); } else { con.Open(); SqlDataAdapter sda = new SqlDataAdapter("INSERT INTO SALARY (Salary_ID,Emp_ID,Date_Of_Joining,Date_Of_Retirement,Basic_Pay,Deduction,E_Salary_Code,Date)VALUES('" + Salary_ID.Text + "','" + Emp_ID.Text + "','" + DOJ.Text + "','" + DOR.Text + "','" + Basic_Pay.Text + "','" + Deduction.Text + "','" + ESC.Text + "','" + Date.Text + "')", con); sda.SelectCommand.ExecuteNonQuery(); con.Close(); Salary_ID.Text = ""; Emp_ID.Text = ""; DOJ.Text = ""; DOR.Text = ""; Basic_Pay.Text = ""; Deduction.Text = ""; ESC.Text = ""; Date.Text = ""; Salary_ID.Focus(); MessageBox.Show("SAVED_SUCCESSFULLY!!!"); Add_Salary_Details ds = new Add_Salary_Details(); this.Dispose(false); ds.Show(); } }
private void CLEAR_Click(object sender, EventArgs e) { //Salary_ID.Text = ""; Emp_ID.Text = ""; DOJ.Text = ""; DOR.Text = ""; Basic_Pay.Text = ""; Deduction.Text = ""; ESC.Text = ""; Date.Text = ""; Salary_ID.Focus(); MessageBox.Show("ALL_CLEARED__"); }
private void DELETE_Click(object sender, EventArgs e) { if (Salary_ID.Text == "" || Emp_ID.Text == "") { MessageBox.Show("PLEASE_FILL_ALL_RECOMMENDED_DATA_FIRST_!!"); } else { con.Open(); SqlCommand scd = new SqlCommand("DELETE FROM SALARY WHERE Salary_ID='" + Salary_ID.Text + "' and Emp_ID='" + Emp_ID.Text + "'", con); scd.ExecuteNonQuery(); con.Close(); Salary_ID.Text = ""; Emp_ID.Text = ""; Salary_ID.Focus(); MessageBox.Show("ALL__CLEARED__!!!"); } }