Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void btnSimpanActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSimpanActionPerformed
- // TODO add your handling code here:
- if (txtNoPol.getText().isEmpty()) {
- JOptionPane.showMessageDialog(this, "Nomor polisi belum diisi!");
- } else if (cbJenis.getSelectedItem().equals("-Pilih Jenis Kendaraan-")) {
- JOptionPane.showMessageDialog(this, "Jenis kendaraan belum dipilih");
- } else {
- String nopol, jenis, sql;
- nopol = txtNoPol.getText();
- jenis = cbJenis.getSelectedItem().toString();
- sql = "INSERT INTO tb_parkir(no_pol,jenis,tgl_masuk,jam_masuk)"
- + "VALUES('"+nopol+"','"+jenis+"',CURDATE(),CURTIME())";
- try{
- konek.st = konek.conn.createStatement();
- konek.st.execute(sql);
- }
- catch (SQLException e){
- JOptionPane.showMessageDialog(this, "Data gagal disimpan"+e);
- return;
- }
- JOptionPane.showMessageDialog(this, "Data berhasil disimpan");
- }
- resetAll();
- tampil_masuk();
- tampil_keluar();
- }//GEN-LAST:event_btnSimpanActionPerformed
Advertisement
Add Comment
Please, Sign In to add comment