private void btnSave_Click(object sender, EventArgs e) { string connectionSQL = "server=localhost;user id=root;password=;database=db_junisman_kulit;"; MySqlConnection conn = new MySqlConnection(connectionSQL); try { MySqlCommand cmd = new MySqlCommand("INSERT INTO tb_bahan_baku(kode_barang,nama,kode_kategori,satuan,harga,keterangan) VALUES ('" + textBox1.Text + "', '" + textBox2.Text + "', '" + comboBox2.SelectedValue + "', '" + comboBox2.SelectedValue + "', '" + textBox3.Text + "', '" + richTextBox1.Text + "')", conn); conn.Open(); cmd.ExecuteNonQuery(); MessageBox.Show("Data Telah disimpan!!"); } catch (MySqlException ex) { MessageBox.Show("Can't connect to database\n" + ex.ToString()); } finally { conn.Close(); MessageBox.Show("Terima Kasih - Junisman Harefa"); } }