java - Show table modified by executeUpdate() -


i'm doing program user can queries hand , results showed in jtable, example:

userquery= "delete cds nro_cd = 4;"  

and i'm using code

if (statement.execute(userquery)){     resultset rs = statement.executequery(userquery);     table.setmodel(dbutils.resultsettotablemodel(rs));     joptionpane.showmessagedialog(null, "consulta realizada");     rs.close();     }     else {         statement.executeupdate(userquery);         joptionpane.showmessagedialog(null, "modificacion realizada");     } 

my problem when execute update don't resultset, there anyway select table updated?

my problem when execute update dont resultset ...

that correct. number of rows affected (i.e. deleted, in example)

... there anyway select table udpated?

i assume asking if there way select find rows deleted / updated in previous statement.

no there isn't.

for start, if rows have been deleted, won't there queried. (obviously!)

a regular database not versioned. can't see state of database before insert / update / delete.


if need know records deleted or updated, think best bet restructure code this:

  1. start transaction:
  2. select rows updated or deleted.
  3. read resultset of select , record need in application ... or maybe in temporary table.
  4. perform updates / deletes
  5. commit transaction.

now can use information recorded in step 3.


see also:


Comments

Popular posts from this blog

php - How to display all orders for a single product showing the most recent first? Woocommerce -

asp.net - How to correctly use QUERY_STRING in ISAPI rewrite? -

angularjs - How restrict admin panel using in backend laravel and admin panel on angular? -