Irwsoft Data Framework

Update a Record/s
Brief Information
EditionsAll Editions
TopicsUpdate record of a Table.
RemarksIDF supports DML syntaxes to View like DML syntaxes to table.
This documentation also apply for View of Professional or Ultimate Edition.

This sample will show how to update records of Person table which PersonID less than 5.

C# code
// declare new instance and set its values.
// Note : set using Column.Value property

PersonTable person = new PersonTable();

// Set all Column properties with data to updated
person.FirstName.Value = "UpdatePerson";

// using SqlUpdateto use update SQL-object
SqlUpdate update = new SqlUpdate(person);
// Don’t forget to set connection string !
// NOTE : it is optional if the data-schema class using default connection.

update.ConnectionString = "...";  // [OPTIONAL]

// set all columns used to update, FirstName.
// NOTE : if you not specify columns it will add all columns exclude read-only columns.


// set the condition PersonId < 5
update.Where.Compare(person.PersonId, ComparisonOperator.Less, 5);

// Execute the query and return number of rows affected by operation.
int r = update.Execute();

Related Topics :

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