private void button2_Click(object sender, EventArgs e) { Kendaraan ldm = new Kendaraan(); ldm.Show(); this.Hide(); }
private void edit_Click(object sender, EventArgs e) { con.Open(); string str = "update Kendaraan set " + "Nama_Kendaraan=@Nama_Kendaraan, Nopol=@Nopol, Harga_sewa=@Harga_sewa where ID_Mobil=@ID_Mobil"; SqlCommand cmd = new SqlCommand(str, con); cmd.CommandType = CommandType.Text; cmd.Parameters.Add(new SqlParameter("ID_Mobil", tb_id.Text)); cmd.Parameters.Add(new SqlParameter("Nama_Kendaraan", tb_namaker.Text)); cmd.Parameters.Add(new SqlParameter("Nopol", tb_nopol.Text)); cmd.Parameters.Add(new SqlParameter("Harga_sewa", tb_harga.Text)); cmd.ExecuteNonQuery(); Kendaraan f1 = new Kendaraan(); f1.Show(); this.Hide(); con.Close(); MessageBox.Show("Record Updated Successfully"); }
private void delete_Click(object sender, EventArgs e) { con.Open(); SqlCommand cmd = con.CreateCommand(); cmd.CommandType = CommandType.Text; cmd.CommandText = "delete from Kendaraan where ID_Mobil='" + tb_id.Text + "'"; cmd.ExecuteNonQuery(); con.Close(); Kendaraan f1 = new Kendaraan(); f1.Show(); this.Hide(); MessageBox.Show("Data Kendaraan Dihapus"); }
private void done_Click(object sender, EventArgs e) { string namakendaraan = tb_namaker.Text; string nopol = tb_nopol.Text; string harga = tb_harga.Text; DB data = new DB(); data.kendaraan(namakendaraan, nopol, harga); Kendaraan f1 = new Kendaraan(); f1.Show(); this.Hide(); }