I want to know if this delete statement actually deleted something, the code below always executes the second . Whether it has destroyed something or not, what is the proper way to do it? Public Deliver (String Pimm, String Powered) {{Create the created space Player = conn.prepareStatement ("Remove from players, where P_Name = '" + pname + "' and P_Word = '' + Pword + "''); createPlayer.execute (); if (createPlayer.execute () == true) {JOptionPane.showMessageDialog (tap," Player successfully deleted! ");} Else {JOptionPane. ShowMessageDialog (empty, "player is not present!", "Not deleted", joptionpan.rrro_mmseg);}} hold (exception e) {}}
you actually remove This statement is executing twice, since you call Instead, use the row that has been modified to the number of rows you have: .execute () twice in most cases, you do not have the possibility of data that can be deleted by the statement if you can Run another time.
int lines generated = createPlayer.executeUpdate (); if (Affected by rows & gt; 0) {JOptionPane.showMessageDialog (tap, "Player Successful Apurwk deleted! "); } Else {JOptionPane.showMessageDialog (empty, "Player is not present!", "Not deleted", JOHNPANPAN.ARROOM_MMSEG); }
Comments
Post a Comment