lemansky

Untitled

Dec 2nd, 2020
341
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public void insert(String[] columnsArray, String[] valuesArray, String table){
  2.         String columns = String.join(", ", columnsArray);        
  3.         String values = String.join(", ", columnsArray);
  4.        
  5.         String sql = "INSERT INTO " + table + " (" + columns + ") VALUES (" + values + ") ";
  6.         try{
  7.             stmt = conn.createStatement();
  8.             stmt.executeQuery(sql);
  9.         } catch (SQLException e) {
  10.             System.out.println(e.getMessage());
  11.         }
  12.     }
RAW Paste Data