DataRow

The DataRow object represents a record in the DataTable. Its Item method provides access to its field values.

You have already seen some of the more useful DataRow properties and methods in the previous sections. The following sections review some of those methods and refer to the earlier sections for examples.

Item

The Item method gives access to the row’s field values. The most common ways to find a value in the Item collection are by field name and by number. For example, the following code sets the value of a DataRow’s LastName field and then displays the value of its first field:

data_row.Item("LastName") = "Stephens" 
MsgBox(data_row.Item(0)) 

The Item method can also take a DataColumn object as an index. Because the DataColumn’s ...

Get Visual Basic® .NET Database Programming 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.