public com.healthmarketscience.jackcess.Row toTableRow() { com.healthmarketscience.jackcess.Row tableRow = new RowImpl((RowIdImpl)_id); tableRow.put(COL_ATTRIBUTE, attribute); tableRow.put(COL_EXPRESSION, expression); tableRow.put(COL_FLAG, flag); tableRow.put(COL_EXTRA, extra); tableRow.put(COL_NAME1, name1); tableRow.put(COL_NAME2, name2); tableRow.put(COL_OBJECTID, objectId); tableRow.put(COL_ORDER, order); return tableRow; }
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); }
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); }
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); }
// 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();
rowtsa.put("ObjectId", id); Row r = catc.getCurrentRow(); r.put("Name", tn); catc.updateCurrentRowFromMap(r); Table srs = db.getSystemTable("MSysRelationships");
if (default4SQL != null) { for (Row row : t) { row.put(cl.getName(), defObj); t.updateRow(row);