/// <summary> /// How to delete Objects /// </summary> public void Step13() { ODB odb = null; try { // Open the database odb = ODBFactory.Open(ODB_NAME); IQuery queryAll = new CriteriaQuery(typeof(Player)); IQuery query = new CriteriaQuery(typeof(Player), Where.Like("name", "%Agassi")); Objects <Player> players = odb.GetObjects <Player>(queryAll); players = odb.GetObjects <Player>(query); // Gets the first player (there is only one!) Player agassi = players.GetFirst(); odb.Delete(agassi); odb.Close(); odb = ODBFactory.Open(ODB_NAME); // Now query the databas eto check the change players = odb.GetObjects <Player>(); Console.WriteLine("\nStep 13 : Deleting Agassi"); int i = 1; // display each object while (players.HasNext()) { Console.WriteLine((i++) + "\t: " + players.Next()); } } finally { if (odb != null) { // Close the database odb.Close(); } } }