To access data in code, use properties and methods of the C1.Data.C1DataTable object returned by the DataTable property. As with all programmatic classes in DataObjects for .NET Express, C1DataTable object model is based on the ADO.NET DataTable object model, so you will find its methods and properties familiar if you already know ADO.NET.
Here is a brief syntax description for most common programmatic tasks in accessing data in code (in Visual Basic, replace indexing brackets "[index]" with parentheses "(index)"):
- C1ExpressTable.DataTable.Rows.Count – number of rows in the table.
- C1ExpressTable.DataTable.AddNew() – adds a new row to the table.
- C1ExpressTable.DataTable.Rows[index].Delete() – deletes a row from the table.
- C1ExpressTable.DataTable.Rows[index] – a data row, a C1DataRow object.
To get/set field value in a row, (C1DataRow object), use row[field_name] or row[field_index], or, with full access path, C1ExpressTable.DataTable.Rows[row_index] [field_index].
- C1DataRow.GetChildRow(s) – gets child rows with respect to a master-detail relation.
- C1DataRow.GetParentRow(s) – gets parent rows with respect to a master-detail relation.
- C1DataRow.Modified – returns true, if the row has been modified.
- C1DataRow.RowState – returns one of the DataRowState enumeration values: Unchanged, Modified, Added, Deleted, or Detached.
- C1DataRow.BeginEdit/EndEdit/CancelEdit – start/end/rollback edit mode for a row.