Advertisement
Guest User

Untitled

a guest
Jun 29th, 2016
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. try {
  2. Class.forName(driver);
  3. Connection con=DriverManager.getConnection(url, user, pass);
  4. String sql="insert into inventory"
  5. +"(Product_Code,Product_Name,Quantity,Cost)"
  6. +"value(?,?,?,?)";
  7. PreparedStatement pst=con.prepareStatement(sql);
  8. pst.setString(1, product_code.getText());
  9. pst.setString(2, product_name.getText());
  10. pst.setString(3, quantity.getText());
  11. pst.setString(4, price.getText());
  12. pst.executeUpdate();
  13. JOptionPane.showMessageDialog(this, "entry successful");
  14.  
  15.  
  16. }
  17. catch(ClassNotFoundException | SQLException | HeadlessException e){
  18. JOptionPane.showMessageDialog(this, "entry successful");
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement