Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package bookshelf;
- ...
- private void createCardBtnMouseClicked(java.awt.event.MouseEvent evt) {
- try {
- Connection c = DriverManager.getConnection("jdbc:mysql://localhost:3306/bookshelf", "root", "apple2473");
- Statement st = c.createStatement();
- String name = Stname.getText();
- int lbcno = Integer.parseInt(LBCNO.getText());
- String clas = (String) JCBCLAS.getSelectedItem();
- String year = YEAR.getText();
- String q1 = "insert into lbc_card values(" + lbcno + ",'" + name + "','" + clas + "','" + year + "');";
- st.executeUpdate(q1);
- nametf.setText(name);
- lbcnotf.setText("" + lbcno);
- clastf.setText(clas);
- fytf.setText(year);
- View_lbc.setVisible(true);
- } catch (Exception e) {
- JOptionPane.showMessageDialog(null, "" + e);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement