Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void updateTable(String tableName, String poleSzukane, String wartoscSzukana, String poleZmienne, String nowaWartosc){
- Statement statement;
- Connection connection;
- try{
- Class.forName("org.sqlite.JDBC");
- connection = DriverManager.getConnection("jdbc:sqlite:" +tableName+ ".db");
- statement = connection.createStatement();
- String query = "UPDATE " + tableName + " SET " + poleZmienne+ " = \""+nowaWartosc+"\" WHERE "+poleSzukane+" = \""+wartoscSzukana+"\"";
- ResultSet wynik = statement.executeQuery(query);
- statement.close();
- connection.close();
- }catch(Exception e){
- e.printStackTrace();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment