Irwsoft Data Framework

Insert a New Record into Table
Brief Information
EditionsAll Editions
TopicsInsert a record into 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 insert a record into Person table.

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 be inserted
person.FirstName.Value = "NewPerson";
person.Status.Value = true;
person.LeaderId.Value = 1;

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

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

// set all columns used in insert process, FirstName and Status.
// NOTE : if you not specify columns it will add all columns exclude read-only columns.

insert.Columns.Add(person.FirstName);
insert.Columns.Add(person.Status);
insert.Columns.Add(person.LeaderId);

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


Related Topics :

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