The column name is kept in the DataColumn object. Each
table in a DataSet has a collection of DataColumns.
So, the following enumeration will give you the ordinal
position and name of each column in a table.
Dim col as DataColumn
For each col in ds.tables(0).columns
Debug.writeline(col.ordinal.tostring & ": " &
col.columnname)
next
If you need to get the contents of a specific row and
column, the best way I know is to declare a row, like
this:
Dim r as DataRow
r = ds.tables(0).rows(x)
....where x is the row position of the specific row you
need.
Then, given a specific column ordinal (that you might
have obtained from an enumeration such as the one above),
the following will give you the value you need:
r(col.ordinal)
Of course, you can use another integer as well. This
will list all the values in a table:
Dim table as DataTable
Dim row as DataRow, i as integer
For each row in table.rows
For i = 0 to table.columns.count - 1
debug.write (row(i))
Next
Next
You can also use the column name to reference specific
values, like this:
r(col.columnname)
Similarly, you can use any string value, as long as it's
a column name - like this:
r("Col1") ...assuming there's a column called "Col1".
This is because "items" (i.e. a specific column value
within a DataTable row) is the default collection for the
DataRow object. Like most collections, it can be
referenced by a string value (column name) or an integer
(ordinal position).
Hope that helps