Any ideas to delete all records matching a query? (SOLVED)

Mar 6, 2013 at 8:53 PM
Any ideas of doing a bulk delete?

delete from mytable
where mytable.FirstName like 'Nick%'

When I was trying to do the delete in a foreach loop, I got an error (
Error:10:Internal error : The last object of the commited zone has been deleted but the Zone still have objects : nbobjects=0)

Ultimately though, I'd just like to call odb.Delete<>().Where(d=>d.CacheDate<DateTime.Now);

Ok, Para-phrased that a bit. :)
Mar 7, 2013 at 7:13 AM
Edited Mar 7, 2013 at 7:14 AM
you need to firstly query for the objects you want to delete, and then in the same scope of ndatabase you could delete them through the foreach. E.g.:
using (var odb = OdbFactory.Open("dbname.ndb"))
    var allObjects = odb.QueryAndExecute<object>().ToList();
    foreach (var itemToDelete in allObjects)
And that's all ;)