Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void submitActionPerformed(java.awt.event.ActionEvent evt) {
- // TODO add your handling code here:
- Connection con;
- try{
- Class.forName("com.mysql.jdbc.Driver");
- con=(Connection)DriverManager.getConnection("jdbc:mysql://localhost:3306/autoexotic","root","");
- String insertRow = "INSERT INTO users(username, password) VALUES (?,?)";
- PreparedStatement statement = con.prepareStatement(insertRow);
- statement.setString(1, userField.getText());
- statement.setString(2, new String(passwordField.getPassword()));
- // statement.setString(3, "ACTIVE");
- //statement.setString(4, "0");
- int rowsInserted = statement.executeUpdate();
- if (rowsInserted > 0){
- output.setText("Staff Account Created: " + userField.getText());
- jTable1.repaint();
- } else{
- output.setText("Sorry, an error occured while creating the new account!");
- statement.close();
- con.close();
- }
- }catch(Exception e){
- System.out.println(e);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement