@Override public Row updateRow(Row row) throws IOException { return wrapped.updateRow(row); }
Table tbl = db.getTable(tableName); Row row = CursorBuilder.findRowByPrimaryKey(tbl, 3); // i.e., ID = 3 if (row != null) { // Note: column names are case-sensitive row.put("Title", "The New Title For This Book"); tbl.updateRow(row); }
@Override public ComplexValue.Id updateRawValue(Row rawValue) throws IOException { _flatTable.updateRow(rawValue); return getValueId(rawValue); }
String dbFile = "C:/Users/Public/test/DB.mdb"; try (Database db = DatabaseBuilder.open(new File(dbFile))) { Table table = db.getTable("Table1"); Cursor cursor = CursorBuilder.createCursor(table); int testNum = 1; for (Row row : cursor.newIterable().addMatchPattern("testnum", testNum)) { row.put("active", true); table.updateRow(row); } } catch (Exception e) { e.printStackTrace(System.out); }
try (Database db = DatabaseBuilder.open(new File("C:/Users/Public/mdbTest.mdb"))) { Table table = db.getTable("Members"); Row row = CursorBuilder.findRow(table, Collections.singletonMap("MemberID", 1)); if (row != null) { row.put("SponsorID", "0"); // "Long Integer" in Access row.put("FeePaid", "130"); // "Currency" in Access table.updateRow(row); } else { System.out.println("row not found."); } } catch (Exception e) { e.printStackTrace(System.out); }
// open existing database Database db = DatabaseBuilder.open(new File( "C:/Users/Gord/Desktop/foo.accdb")); String tempTableName = "TemporaryNameForTable"; // import CSV file into new table with temporary name ImportUtil.Builder ib = new ImportUtil.Builder(db); ib.setTableName(tempTableName); ib.importFile(new File("C:/Users/Gord/Desktop/foo.csv")); // rename the new table Table mso = db.getSystemTable("MSysObjects"); Row r = CursorBuilder.findRow(mso, Collections.singletonMap("Name", tempTableName)); r.put("Name", "type"); // new name is "type" mso.updateRow(r); db.close();
for (Row row : t) { row.put(cl.getName(), defObj); t.updateRow(row);