Using Strongly Typed DataSet Objects

Strongly typed DataSet objects simplify the development process, making it easier to write code to access and modify the contents of your DataSet. Let’s look at a few examples that compare working with data in a standard untyped DataSet versus working with a strongly typed DataSet.

Adding a Row

Each class for the DataTable objects in your DataSet offers two ways to add a new row to the DataTable. Calling New<TableName>Row returns a new strongly typed DataRow for your DataTable. You can then set values for columns in the row using properties of the strongly typed DataRow, as shown in the following code snippet:

Visual Basic

Dim ds As New NorthwindDataSet() Dim tblCustomers As NorthwindDataSet.CustomersDataTable ...

Get Programming Microsoft® ADO.NET 2.0 Core Reference, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.