Mattersphere Developers Forum
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Go down
avatar
Admin
Admin
Posts : 122
Join date : 2018-12-17
https://mattersphere-devs.forumotion.com

Delete An Associate From The File Programatically Empty Delete An Associate From The File Programatically

Tue 28 Jan 2020 - 10:51
Hi,
I need to delete an associate from the file but I'm having some trouble, can someone let me know how it's done correctly please. I've tried this...
Code:

foreach(Associate del in CurrentFile.Associates)
{
    if(del.ID == Convert.ToInt64(task1.Notes))
    {
        CurrentFile.Associates.Remove(del.Contact);
        CurrentFile.Update();
        break;
    }
}
but get this error message on CurrentFile.Update():
Code:

Detail: System.Data.DeletedRowInaccessibleException: Deleted row information cannot be accessed through the row. at System.Data.DataRow.BeginEditInternal() at System.Data.DataRow.set_Item(DataColumn column, Object value) at System.Data.DataRow.set_Item(String columnName, Object value) at FWBS.OMS.OMSFile.Update()
and I've tried this bit of code, but nothing happens:
Code:

foreach(Associate del in CurrentFile.Associates)
{
    if(del.ID == Convert.ToInt64(task1.Notes))
    {
        del.Delete();
        del.Update();
    }
}
CurrentFile.Update();
any ideas?

thanks
Mike
Back to top
Permissions in this forum:
You cannot reply to topics in this forum