Thursday 15 January 2015

How to refresh MS Access database in Java -


I'm thinking of refreshing the database after inserting a new line without reopening the entire application. I want to be able to see new data in the next phase of my application. I'm not getting any solutions, so if you post an example, I'd be happy. Of course if this is possible. Here is my connection method

  try {string driver = "sun.jdbc.odbc.JdbcOdbcDriver"; Class.forName (driver); String db = "jdbc: odbc: flovolves"; Con = DriverManager.getConnection (DB); St = con.createStatement (ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE); } Hold (Exception pre) {ex.printStackTrace (); }   

Here is one of my consolidation methods.

  string sql = "choose from Typy *"; {Try the result result; Results = st.executeQuery (SQL); Result.moveToInsertRow (); String string name = (string) najvazwuruffield.gate text (); Result.updateString ("Type", String Najwa); String string DN = (string) dnZaworuField.getText (); Results. Update string ("DN", string DNS); String string pn = (string) pnZaworuField.getText (); Results. Update string ("PN", string PN); String string idex = (string) indictfield.gate text (); Results. Update string ("index", string index); Result.insertRow (); Result.close (); Yeppenpine Show Message Dialeg (empty, "W. Provedosono Dane", "Communeate", Joppenpen. INFORMATION_MESSAGE); } Hold (Exception pre) {ex.printStackTrace (); To insert, your code looks correct (though I use an insert statement instead)  

You need a database and the new The data should be entered:

  select string from sql = "Typy; result result; result = st.executeQuery (SQL); while (result.next ()) {Sting Indic = result .getString ("Indix"); // etc. Do something with new data}    

No comments:

Post a Comment