how could i refresh bindingsource / bindingcollection after deletemulti operation ?

Posts   
 
    
Posts: 11
Joined: 30-Nov-2010
# Posted on: 22-Dec-2010 12:51:38   

hi,

this is my code...

IPredicate filter = (OdinBseFields.CertificateNo == frmOdinBSE.certNo); OBC_Coll1.DeleteMulti(filter);

OBC_BS.EndEdit(); OBC_Coll1.SaveMulti(true); OBC_BS.ResetBindings(true);

but bindingsource and bindingcollection still shows deleted records

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 22-Dec-2010 15:02:45   

So records get deleted from the database, right? Could you please examine the generated code to check on which SQl commands are produced?

Posts: 11
Joined: 30-Nov-2010
# Posted on: 23-Dec-2010 06:32:04   

yes records are deleted from the database but collection and binding source still shows the deleted record, when i reload the form then everything is ok

when i delete single record using binding navigator control everything works fine

the problem is when i delete using coll.deletemulti() method

in short coll and binding source does not get refreshed after deletemulti method execution

please help me

thanks in advance and have a nice day

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 23-Dec-2010 08:47:43   

What happens is that you delete entities directly from the persistence storage, without removing them from the bound collection.

So either you remove the entities from the bound collection after you delete them from the persistence storage, or remove them from the collection without deleting them from the persistnce storage, and later track the removed entities, and delete them from the storage.

Or keep your code but to reflect this change, you will need to refetch the collection from the database.