multi-row delete sample

Posts   
 
    
mkamoski avatar
mkamoski
User
Posts: 116
Joined: 06-Dec-2005
# Posted on: 10-Mar-2006 21:51:29   

Anyone have or know where one can find a multi-row delete sample?

(VS.NET 2003, VB.NET, with Adapter code preferred.)

bclubb
User
Posts: 934
Joined: 12-Feb-2004
# Posted on: 11-Mar-2006 03:06:44   

Are you want to delete from a grid or a collecton? Winforms or Webforms?

JSobell
User
Posts: 151
Joined: 07-Jan-2006
# Posted on: 11-Mar-2006 14:24:33   

Under "Using the generated code / Using the entity collection class":

Deleting one or more entities from the persistent storage _If you want to delete one or more entities from the persistent storage the same problem as with updating a set of entities appears: you first have to load them into memory, call Delete() and they'll be deleted. To delete a set of entities from the persistent storage directly, you can use DeleteMulti() overloads or the DeleteMultiManyToOne method to achieve your goal. All DeleteMulti() methods work directly on the persistent storage except one, the DeleteMulti() method which does not take any parameters. That one works with the objects inside the collection and deletes them one by one from the persistent storage using an own transaction if the current collection isn't part of an existing transaction. (See for more information about transactions the section Transactions). The DeleteMulti() methods which do accept parameters and thus work on the persistent storage work the same as the UpdateMulti() methods, except of course the DeleteMulti() methods do not accept an entity with changed fields. See for an example how to filter rows for DeleteMulti() the UpdateMulti() example given earlier on this page. Note: DeleteMulti() is not supported for entities which are in a hierarchy of type TargetPerEntity (See Concepts - Entity inheritance and relational models.). This is by design, as the delete action isn't possible in one go with proper checks due to referential integrity issues. _

Cheers, Jason