Delete UD100A record

Hi Everybody, how can i delete UD100A record from Custom Code?

i tried with DeleteByID but isn’t working

Regards and Thanks

Have you already tried setting the .RowMod = “D”;
This post is for removing an OrderRel but thinking it could be applied to UD100A
or at least it might give you some ideas…

1 Like

DeleteByID is for UD100 if I recall in order to delete the children you Get UD100 and then you iterate through the children and mark them as RowMod “D” then you call Update.

Assuming your doing it in a Customization.

ud100Adapter.UD100Data.UD100A.Rows

I will try, in a few minutes i let you know thre results

Hi again, i tried this:

foreach(DataRow dr in adapterUD101.UD101Data.UD101A.Rows)
				{
					if(dr["ChildKey1"].ToString() == childKey)
					{
						MessageBox.Show(""+childKey);												
						adapterUD101.UD101Data.UD101A.Rows[i].BeginEdit();
						adapterUD101.UD101Data.UD101A.Rows[i]["RowMod"] ="D";
						adapterUD101.UD101Data.UD101A.Rows[i].EndEdit();
						adapterUD101.Update();
					}
					i++;
				}

but doesn’t work, did i forget something?

// Try This First
foreach(DataRow dr in adapterUD101.UD101Data.UD101A.Rows)
{
  if(dr["ChildKey1"].ToString() == childKey)
    {
    MessageBox.Show(""+childKey);
    dr.BeginEdit();
    dr["RowMod"] = "D";
    dr.EndEdit();
  }
}

adapterUD101.Update();
// Second Try This
// I think this is the way I usually have it for a regular UD table atleast not sure if same works with a child
foreach(DataRow dr in adapterUD101.UD101Data.UD101A.Rows)
{
  if(dr["ChildKey1"].ToString() == childKey)
    {
      adapterUD101.Delete(dr);
    }
}

adapterUD101.Update();

The second way works

I only added a “break” on the loop

here the code:
foreach(DataRow dr in adapterUD101.UD101Data.UD101A.Rows)
{
if(dr[“ChildKey1”].ToString() == childKey)
{
adapterUD101.Delete(dr);
break;

				}
				
			}
			adapterUD101.Update();

thank you very much for your help