Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- try
- {
- con.setAutoCommit(true);
- String InsertSQL = "insert into medium(Name, Type, Description, ISBN, Length, Regisseur, FSK, Barcode, Amount, Status_idStatus) "
- + "values (?,?,?,?,?,?,?,?,?,?);";
- PreparedStatement sta = con.prepareStatement(InsertSQL);
- Integer barcode = generateBarcode();
- String bc = barcode.toString();
- sta.setString(1, values[0]);
- sta.setString(2, values[7]);
- sta.setString(3, values[8]);
- sta.setString(4, values[1]);
- sta.setString(5, values[2]);
- sta.setString(6, values[3]);
- sta.setString(7, values[6]);
- sta.setInt (8, barcode );
- sta.setInt (9, amount );
- sta.setInt (10, status );
- System.out.println(InsertSQL);
- int x = sta.executeUpdate();
- con.setAutoCommit(false);
- return x;
- }catch(Exception e){System.out.println("Something's wrong!"); e.printStackTrace();}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement