private void save_Click(object sender, EventArgs e) { matchEmployeID(); SqlConnection con = new SqlConnection(@"Data Source=(LocalDB)\v11.0;AttachDbFilename=E:\BankManagementSystem\BankManagementSystem\BankManagement.mdf;Integrated Security=True"); con.Open(); string fullName = textBox4.Text.ToString() + " " + textBox5.Text.ToString(); string date = comboBox1.Text.ToString() + "-" + comboBox2.Text.ToString() + "-" + comboBox3.Text.ToString(); SqlCommand sc = new SqlCommand("insert into employee(Employee_ID,NID,joinDate,Dept,FirstName,LastName,FullName,FatherName,MotherName,sex,email,phone,dateOfBirth,Region,bloodGroup,Marital_____Status) values('" + textBox1.Text + "','" + textBox2.Text + "','" + dateTimePicker1.Text + "','" + textBox3.Text + "','" + textBox4.Text + "','" + textBox5.Text + "','" + fullName + "','" + textBox6.Text + "','" + textBox7.Text + "','" + gender + "','" + textBox8.Text + "','" + textBox9.Text + "','" + date + "','" + comboBox4.Text + "','" + comboBox5.Text + "','" + comboBox6.Text + "')", con); try { if (textBox1.Text != " ") { sc.ExecuteNonQuery(); MessageBox.Show("Successfully Saved."); employeInfo2 obj = new employeInfo2(); obj.Show(); // textBox1.Text = textBox99.Text; } } catch { //Error when save data MessageBox.Show("Error to save on database"); con.Close(); } }
private void next_Click(object sender, EventArgs e) { employeInfo2 em = new employeInfo2(); em.Show(); }