Irwsoft Data Framework

Delete records of Relation Data-schema
Brief Information
EditionsAll Editions
TopicsDelete records of a relation dataschema.
RemarksA dataschema class can have relations to another dataschema as a master-table or a child-table. For more information about Relation Dataschema.

This sample will show how to delete records from Table object of relation data-schema.

Before you can delete a record/s, you should know :


Example : delete the first and second member records of Andy.

C# code
// continue from sample " Select Single Table ",
// Execute the query and return DataView instance that provide properties and methods to access data

Irwsoft.Data.DataView dv = select.Execute();

// Extract PersonTable object of Andy into pAndy variable.
PersonTable pAndy = dv.GetDataSchemaObject<PersonTable>(person, 0);

// 1) You must retrieve the members data that you want to delete.
//    because we do not set the select condition it will retireve all member records.

pAndy.Members.Select();

// Assumes there are five records of member,
// to delete the first record, and

pAndy.Members.Rows[0].Delete();

// the second record.
pAndy.Members.Rows[1].Delete();

// Now after all completed, call Delete to commit deletion.
// NOTE : this will delete all rows which its DataRowState property value is Irwsoft.Data.DataRowState.Deleted

pAndy.Members.Delete();



Related Topics :

Irwsoft Data Ultimate Edition provides all enhanced features of Irwsoft Data Framework and support from irwsoft.