1. Create a DataSet object. |
Dim dataset as New DataSet("DataSetName") |
2. Create a new DataTable object. |
Dim datatable as New DataTable("DataTableName") |
3. Create a new DataColumn object. |
Dim datacolumn as New DataColumn("DataColumnName", GetType(String)) |
4a. Add the DataColumn object to the DataTable's Columns collection. |
datatable.Columns.Add(datacolumn) |
4b. You could optionally create the column object and add it to the DataTable's Columns collection in one step. |
datatable.Columns.Add("DataColumnName", GetType(String)) |
5. Optionally assign an array of DataColumn objects to the PrimaryKey property of the DataTable. |
datatable.PrimaryKey = New DataColumn() {datatable.Columns("FirstName"), datatable.Columns("LastName")} |
6. Add the DataTable object to the DataSet's Tables collection. |
dataset.Tables.Add(datatable) |