private void btDelete_Click(object sender, EventArgs e) { string mysql = "DELETE FROM k3d_employee WHERE id=" + txtStt.Text; myDBConnection = new cMySQLConnection(); myDBConnection.Delete(mysql); LoadData(); }
private void btUpdate_Click(object sender, EventArgs e) { int gender = 1; if (cboGender.SelectedText == "Nam") { gender = 0; } string mysql = "Update k3d_employee set name='" + txtName.Text + "', job='" + txtJob.Text + "', gender=" + gender + ", phone='" + txtPhone.Text + "', address='" + txtAddress.Text + "', salary_base=" + txtSalaryBase.Text + " Where id=" + txtStt.Text; myDBConnection = new cMySQLConnection(); myDBConnection.Update(mysql); LoadData(); }
private void button2_Click(object sender, EventArgs e) { btAddNew.Visible = true; btSave.Visible = false; int gender = 1; if (cboGender.SelectedText == "Nam") { gender = 0; } string mysql = "Insert into k3d_employee (id, name, job, gender, phone, address, salary_base) VALUES(null,'" + txtName.Text + "','" + txtJob.Text + "'," + gender + ",'" + txtPhone.Text + "','" + txtAddress.Text + "'," + txtSalaryBase.Text + ")"; myDBConnection = new cMySQLConnection(); myDBConnection.Insert(mysql); LoadData(); }
public void LoadData() { myDBConnection = new cMySQLConnection(); myDBConnection.LoadToDataGridView("Select * From k3d_employee", DGView1); }