May 2002
Beginner
408 pages
9h 10m
English
At this point, the schema of the DataSet is entered and you're ready to add some data. Recall that the column collection of the DataTable defines the schema, and the rows collection of the DataTable defines the data. In other words, to add data to our DataTable, all we need to do is add some rows to our DataTable: dtEmployees.
Adding rows to the dtEmployees DataTable is easy to do. First, you need to use the NewRow() method of the dtEmployees object. NewRow() returns a reference to a new row for your DataTable. Next, you must specify values for the columns in the newly created row. Lastly, you must add the row to the DataTable. Listings 2.3 and 2.4 demonstrate this by adding a few rows to our existing ...
Read now
Unlock full access