→
This
class makes up the other part of the DataTable class. The columns within a data
table are defined in terms of the DataColumn class. The actual data within the
table is accessed using the DataRow object.
→
Suppose
we are set up connection to data base
using data set and data adapter as described in previous section.
→
In
the following code, you might notice the use of the DataRow indexer to access
values from within that row. The value for a given column can be retrieved
using one of the several overloaded indexers. These permit you to retrieve a
value knowing the column number, name, or DataColumn :
foreach(DataRow
row in ds.Tables[“Customers”].Rows)
Console.WriteLine(“’{0}’
from {1}” , row[0] ,row[1]);
→
One
of the most appealing aspects of DataRow is that it is versioned. This permits
you to receive various values for a given column in a particular row. The
versions are described in the following table.
0 comments:
Post a Comment