private void insertBTNActionPerformed( java.awt.event.ActionEvent evt) { // GEN-FIRST:event_insertBTNActionPerformed // TODO add your handling code here: String issue_date = StaticAccess.getDate(issueDayCBX, issueMonthCBX, issueYearCBX); String return_date = StaticAccess.getDate(returnDayCBX, returnMonthCBX, returnYearCBX); try { int book_id = database.DatabaseFunctionClassBooks.getBookId(StaticAccess.getItem(bookNameCBX)); if (book_id == 0) { JOptionPane.showMessageDialog( this, "Please select book name", "Empty!!", JOptionPane.INFORMATION_MESSAGE); return; } database.DatabaseFunctionClassBorrow.insert(issue_date, return_date, book_id, member_id); JOptionPane.showMessageDialog( this, "Successfully borrowed", "Borrowed!!", JOptionPane.INFORMATION_MESSAGE); this.dispose(); } catch (SQLException ex) { StaticAccess.showMassageDialog(this, "Sorry insert can't possible", ex); } } // GEN-LAST:event_insertBTNActionPerformed
void loadCBX() throws SQLException { ResultSet rs = database.DatabaseFunctionClassBooks.getBooksTitle(); while (rs.next()) { bookNameCBX.addItem(rs.getString(1)); } }