ComponentOne DataObjects for .NET
Programmatic Access
DataObjects for .NET (Enterprise Edition) > Schema Objects > Programmatic Access

To access a table view rowset, obtain a C1DataTable object from a C1DataSet component (using the TableViews collection property), and use the Rows collection containing C1DataRow objects representing table view rows. To perform actions on table view rows or table view data as a whole, use appropriate methods and properties of the C1DataTable and C1DataRow classes. Their object model is similar to that of ADO.NET.

DataObjects for .NET also allows typed access to table and table view rows. For each table and table view, DataObjects for .NET generates a class representing its row. For example, ProductsRow is an object (business object, data object) where each field has a corresponding property (ProductsRow.UnitPrice, ProductsRow.UnitsInStock, and so on) and each relation has a corresponding method (Products.GetOrder_DetailsRows, and so on) allowing you to obtain child rows and the parent row). Using these classes, you can write your business logic code in a convenient, type-safe way, and benefit from Visual Studio code completion features giving you the lists of properties and methods to choose from. See Using Typed Data Objects in Business Logic, for details about data object classes.

To use a data object class in your code, call the static Obj method implemented in every data object class. It obtains a business object given a C1DataRow object as its argument. For example, the following code obtains a ProductsRow business object from a C1DataRow:

To write code in Visual Basic

VB
Copy Code
Dim dataRow As C1.Data.C1DataRow 
Dim product As DataLibrary.DataObjects.DataSet.ProductsRow
product = DataLibrary.DataObjecs.DataSet.ProductsRow.Obj(dataRow)

To write code in C#

C#
Copy Code
C1.Data.C1DataRow dataRow;
DataLibrary.DataObjects.DataSet.ProductsRow product;
product = DataLibrary.DataObjects.DataSet.ProductsRow.Obj(dataRow);