A DataTable object represents a table in a database. But that table has been loaded into memory, and that memory is contained within rows in that DataTable object.
code sample - updating a DataTable with data from a few controls on a table.
1 | Dim dt As DataTable = Me.dsWO.Tables("active_wo_Activity_Tasks") ' Get a table from the dataset |
Code Sample - setting a date field in a data column to null.
It turns out this is fairly tricky
Nulling a date
1 | 'Me.dsWO.active_wo(0).DTCompleted = DBNull.Value |
code sample - drop a column out of a data table.
1 | dt = acn.GetSchema("Columns", Restrictions) |
code sample - adding a column to a data table.
1 | dt.Columns.Add( _ |
With the last 3 samples, you are just changing the in-memory representation of the data table. Not the physical table itself.
More Samples
- [[CopyDataTable]]
- [[SortingDatatable]]