private void button1_Click(object sender, EventArgs e) { MySqlConnection connection = new MySqlConnection("server = localhost; user id = root; password = 02032543; persistsecurityinfo=True; database=final; allowuservariables=True"); MySqlCommand cmd = connection.CreateCommand(); connection.Open(); cmd.CommandType = CommandType.Text; cmd.CommandText = "INSERT INTO customers(CustomersID,CustomerName,Gender,CustomerType,CustomerTelNo) VALUES (@id,@name,@gender,@type,@telno)"; cmd.Parameters.AddWithValue("@id", Useridcus.Text); cmd.Parameters.AddWithValue("@name", passcus.Text); cmd.Parameters.AddWithValue("@gender", combogender1.Text); cmd.Parameters.AddWithValue("@type", combotype.Text); cmd.Parameters.AddWithValue("@telno", telme.Text); cmd.ExecuteNonQuery(); MessageBox.Show("🌻🌻บันทึกสำเร็จ🌻🌻"); Useridcus.Text = ""; passcus.Text = ""; combogender1.Text = ""; combotype.Text = ""; telme.Text = ""; Form2_3 form2_3 = new Form2_3(); form2_3.Show(); }
private void button3_Click(object sender, EventArgs e) { this.Visible = false; Form2_3 form2_3 = new Form2_3(); form2_3.Visible = true; }