May 2010
Intermediate to advanced
1752 pages
41h 17m
English
You have seen in this chapter that you can manipulate the data within a DataSet in three distinct manners:
By using the Tables, Rows, and Columns collections
By using data table readers
By using strongly typed data classes
When you use the various indexers of the DataSet and DataTable type, you can interact with the contained data in a straightforward but loosely typed manner. Recall that this approach requires you to treat the data as a tabular block of cells, as in this example:
static void PrintDataWithIndxers(DataTable dt)
{
// Print the DataTable. for (int curRow = 0; curRow < dt.Rows.Count; curRow++) { for (int curCol = 0; curCol < dt.Columns.Count; curCol++) { Console.Write(dt.Rows[curRow][curCol].ToString() ...