I insert the values of an entire row of jtable in oracle database, based on the ISBN inserted into txtField.
Connection conn = Connessione.ConnecrDb();
Statement stmt = null;
ResultSet emps = null;
try{
String sql= "INSERT INTO PROGETTO.CARRELLO (ISBN, DISPONIBILITA, TITOLO, CASA_EDITRICE, CODICE_AUTORE, GENERE, PREZZO)"
+ "VALUES (?,?,?,?,?,?,?) where isbn=?";
pst=(OraclePreparedStatement) conn.prepareStatement(sql);
pst.setString (1, agg_libro_carr.getText());
pst.execute();
JOptionPane.showMessageDialog(null, "BOOK SAVED");
}
catch (Exception e)
{
JOptionPane.showMessageDialog(null,e);
}
But return error IN/OUT index 2 etc...
thank you
EDIT:
private void button_carrelloActionPerformed(java.awt.event.ActionEvent evt) {
Connection conn = Connessione.ConnecrDb();
Statement stmt = null;
ResultSet emps = null;
try{
String sql= "INSERT INTO PROGETTO.CARRELLO (ISBN, DISPONIBILITA, TITOLO, CASA_EDITRICE, CODICE_AUTORE, GENERE, PREZZO)"
+ "VALUES (?,?,?,?,?,?,?) where isbn=?";
pst=(OraclePreparedStatement) conn.prepareStatement(sql);
pst.setString (1, agg_libro_carr.getText());
pst.setString (2, "DISPONIBILITA");
pst.setString (3, "TITOLO");
pst.setString (4, "CASA_EDITRICE");
pst.setString (5, "CODICE_AUTORE");
pst.setString (6, "GENERE");
pst.setString (7, "PREZZO");
pst.setString (8, agg_libro_carr.getText());
pst.execute();
JOptionPane.showMessageDialog(null, "BOOK SAVED");
}
catch (Exception e)
{
JOptionPane.showMessageDialog(null,e);
}
I need that, having done the research (which works and fills the jtable). depending on the isbn inserted into txtField must insert into the table cart (oracle), the entire line that appears in the jtable. (jtable values are taken from the table "book" (oracle).