private void tambahActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_tambahActionPerformed
        if (dataSudahAda(nama.getText()) == false){
            try{
                Class.forName ("com.mysql.jdbc.Driver");

                String urldb="jdbc:mysql://localhost:3306/restaurant";
                String user=main.dbUser;
                String password=main.dbPassword;
                Connection koneksi = java.sql.DriverManager.getConnection(urldb,user,password);
               
                Statement st = koneksi.createStatement();
                String strSQL = "INSERT INTO `restaurant`.`pegawai` ( `nama` , `password` ) "
                              + "VALUES ( '"+nama.getText()+"', '"+pswd.getText()+"' );";
                st.executeUpdate(strSQL);
                tblModel.insertRow(0, new String[]{nama.getText(), pswd.getText()});

                nama.setText("");
                pswd.setText("");

                st.close();
                koneksi.close();
            }catch(ClassNotFoundException cnfe){
                System.out.println("KESALAHAN SAAT"+"ME-LOAD DRIVER JDBC \n"+cnfe.getMessage());
            }catch(SQLException sqle){
                System.out.println("KESALAHAN SAAT KONEKSI ATAU "+"KESALAHAN QUERY SQL \n"+sqle.getMessage());
            }
        } else {
            JOptionPane.showMessageDialog(null, "Nama pegawai sudah terdaftar!");
        }
    }//GEN-LAST:event_tambahActionPerformed