public void deleteTran(Account acct, String transID) { String[] args = {Integer.toString(acct.ID), transID}; db.beginTransaction(); try { db.delete("trans", "acct_id=? and trans_id=?", args); db.setTransactionSuccessful(); } finally { db.endTransaction(); } }
/** * 删除数据 * * @param rowId 数据id * @param tableName 表名 * @param key 关键字 * @return 是否删除成功 */ public boolean delete(long rowId, String tableName, String key) { return db.delete(tableName, key + "=" + rowId, null) > 0; }