Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Override
- public void actionPerformed(ActionEvent e) {
- // throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
- int x = 1;
- int limit;
- //promts the user to enter input
- // String InputString = JOptionPane.showInputDialog(null, "Enter the Number of Countries: ",JOptionPane.QUESTION_MESSAGE);
- // limit = Integer.parseInt(InputString);
- Connection connection;
- PreparedStatement ps;
- try {
- String dbName = "osdesign";
- String dbUserName = "root";
- String dbPassword = "";
- //String u = jtfuser.getText();
- //String p =jpfpass.getName();
- String connectionString = "jdbc:mysql://localhost/" + dbName + "?user="
- + dbUserName + "&password=" + dbPassword +
- "&useUnicode=true&characterEncoding=UTF-8";
- connection = DriverManager.getConnection(connectionString);
- JOptionPane.showMessageDialog(null, "Connected!");
- //int x = 1;
- User List = new User();
- //User[] List = new User [limit];
- //String query;
- //for (x = 0; x < limit; x++)
- // {
- ///List[x] = new User();
- //List[x].User_type = null;
- List.input(x);
- //String sql = "INSERT into `userlist` (`UsrCode`, `UsrName`,
- `UsrPass`, `UsrPassChgDays`, `UsrPassChgDate`, `Usrtype`) VALUES
- (?,?,?,?,?,?);";
- PreparedStatement preparedStmt = connection.prepareStatement("INSERT INTO
- `userlist`" + "VALUES (?,?,?,?,?,?);");
- String ID = List.ID;
- String name= List.name;
- preparedStmt.setString (1,ID);
- preparedStmt.setString (2,name);
- preparedStmt.setString (3, List.password);
- preparedStmt.setString(4,List.Usr_PassChgDays);
- preparedStmt.setString (5, List.data_of_passChg);
- preparedStmt.setString(6, List.User_type);
- preparedStmt.executeUpdate();
- //btnlogin.equals(result);
- // panel.add(btnlogin);
- // panel.add(jpfpass.getName(),btnlogin);
- if(preparedStmt.equals(true)){
- JOptionPane.showMessageDialog(null, "Great sucess!!!");
- //this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- }
- else{
- JOptionPane.showMessageDialog(null, "FUCK!!!");
- }
- //JOptionPane.showMessageDialog(null, "User sucessfully created");
- }
- catch (SQLException ex) {
- Logger.getLogger(RychlikSystemversion0.class.getName()).log(Level.SEVERE, null, ex);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement