Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- try {
- Class.forName(driver);
- Connection con=DriverManager.getConnection(url, user, pass);
- String sql="insert into inventory"
- +"(Product_Code,Product_Name,Quantity,Cost)"
- +"value(?,?,?,?)";
- PreparedStatement pst=con.prepareStatement(sql);
- pst.setString(1, product_code.getText());
- pst.setString(2, product_name.getText());
- pst.setString(3, quantity.getText());
- pst.setString(4, price.getText());
- pst.executeUpdate();
- JOptionPane.showMessageDialog(this, "entry successful");
- }
- catch(ClassNotFoundException | SQLException | HeadlessException e){
- JOptionPane.showMessageDialog(this, "entry successful");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement