FeekNeusedo
New Member
Ok So I have a program where I add new Players to a database, and where I load them users into a list. The problem is when I delete a user, then go to add a new user the new player gets added in to where the old user was. Basically because that spot is free now and I use:\[code\]rs.moveToInsertRow();\[/code\]is there a way that when adding a new player it 'Always' adds to the end of the the database. Like when you delete a row from table to make the database compress so it has no gaps?here is the codeublic static void Save(){ try {\[code\]String Name = "#####"; String Pass= "#####"; String Host = "######"; Connection con = DriverManager.getConnection(String.format( "jdbc:mysql://%s:%s/%s", Host, "####", "####"), Name, Pass); Statement stmt = con.createStatement (ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE); String sql = "SELECT * FROM Accounts"; ResultSet rs = stmt.executeQuery(sql); rs.moveToInsertRow( ); String userName= TestForm.UsernameTextField.getText(); //make this equal to whats in textfield String password= TestForm.PasswordTextField.getText(); //make this equal to whats in textfield String insertQuery="insert into Accounts (`Username`,`Password`) values ('"+userName+"','"+password+"');"; stmt.executeUpdate(insertQuery); stmt.close(); rs.close();}catch(Exception e){ System.out.println("ERROR"); e.printStackTrace();}}\[/code\]