insert data

String sql = "INSERT INTO `mog`.`mog` ( `idbook`, `name`, `data`, `att`, `photo`, `des`) " + "VALUES (?, ?, ?, ?, ?, ?);"; try { pst = conn.prepareStatement(sql); pst.setString(1, jTextField2.getText()); pst.setString(2, jTextField3.getText()); pst.setString(3, jTextField4.getText()); pst.setString(4, jTextArea1.getText()); pst.setString(5, jTextArea2.getText()); pst.setString(6, jTextField5.getText()); pst.execute(); mog(); JOptionPane.showMessageDialog(rootPane, "The statement has been added"); } catch (Exception e) { JOptionPane.showMessageDialog(rootPane, e); } finally { try { pst.close(); rs.close(); } catch (Exception e) { } }
الاتصال بقواعد البيانات

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.