Anything Else
I've decided not to cover the DataColumn as
there isn't really anything in there, we've seen it adding columns and setting
their properties, that's about it.
Dim dcol as
DataColumnCollection = ds1.Tables("people").Columns
Dim dcol2 as DataColumn = dcol.Item(2)
dcol2.AutoIncrementStep = 3 |
The AutoIncrementStep obviously increases the
step from 1 (default) to 3.
I know that this article has been a bit messy,
but DataSets are a messy. Luckily, it's not too hard to see what we're doing
without much of an explanation. However you should remember that Columns and
Rows are made from Collections and like arrays the collection indexes start at
0. Remember that you must AcceptChanges (in most cases) to have the data sent
back to the dataset.
Exercise
Now using what we've learnt in this part and
part 1, fill a dataset with information from a database and then make some
changes to the data using the DataTable, DataRow and DataColumn objects.
Summary
You've probably seen that the DataSet is a very
complex object and the DataTable, DataRow etc. are just part of that. In Part
3, we'll look at Database data in the DataSet, modifying and then sending back
the data to the database.