コード例 #1
0
        private void BtnHapus_Click(object sender, RoutedEventArgs e)
        {
            using (MySqlCommand cmd = new MySqlCommand())
            {
                conn.Open();
                cmd.CommandText = "DELETE FROM UKURAN_HEWAN WHERE ID_UKURAN_HEWAN = @idukuran";
                cmd.CommandType = CommandType.Text;
                cmd.Connection  = conn;

                cmd.Parameters.AddWithValue("@idukuran", IdUkuranHewanText.Text);
                cmd.ExecuteNonQuery();
                conn.Close();
                GetRecords();
                MessageBox.Show("Berhasil Dihapus!");
                IdUkuranHewanText.Clear();
            }
        }
コード例 #2
0
 private void BtnEdit_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         conn.Open();
         ds      = new DataSet();
         adapter = new MySqlDataAdapter("update ukuran_hewan set NAMA_UKURAN = '" + ComboBoxUkuranHewan.SelectedValue + "'where ID_UKURAN_HEWAN = '" + IdUkuranHewanText.Text + "'", conn);
         adapter.Fill(ds, "ukuran_hewan");
         conn.Close();
         GetRecords();
         MessageBox.Show("Berhasil Diedit!");
         IdUkuranHewanText.Clear();
     }
     catch (Exception err)
     {
         MessageBox.Show(err.Message);
     }
 }
コード例 #3
0
 private void ClearData()
 {
     IdUkuranHewanText.Clear();
     CariUkuranText.Clear();
     ComboBoxUkuranHewan.SelectedIndex = -1;
 }