Irwsoft Data Framework

Update Relation Data-schema
Brief Information
EditionsAll Editions
TopicsUpdate records in Child table of a 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 update a record of Table object of relation data-schema.

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


Example : update 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 update the first record, and

PersonTable newMember = pAndy.Members.Rows[0];
// set all Column properties with data to be updated
newMember.FirstName.Value = "UpdatePerson1";
newMember.Status.Value = true;

// to update the second record
PersonTable newMember = pAndy.Members.Rows[1];
// set all Column properties with data to be updated
newMember.FirstName.Value = "UpdatePerson2";
newMember.Status.Value = true;

// Now call Update method to update all modified rows.
pAndy.Members.Update();


Related Topics :

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