|Important||This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here. ArchiveDisclaimer|
How to: Create DataTables
Data can be stored in memory inobjects. (Datasets are made up of DataTable objects.) You typically create new data tables with TableAdapters using the or by dragging database objects from Server Explorer onto the Dataset Designer.
Data tables are created as a byproduct when you create new TableAdapters in theas well, but they can also be created independently. You create a standalone data table by dragging a DataTable object from the DataSet tab of the Toolbox onto the Dataset Designer.
To create data tables programmatically, see.
The dialog boxes and menu commands you see might differ from those described in Help depending on your active settings or edition. To change your settings, choose Import and Export Settings on the Tools menu. For more information, see.
Creating a DataTable with TableAdapter
Data tables with TableAdapters include methods that fill the table with data and write changes back to the database. You create TableAdapters by running the TableAdapter Configuration Wizard or by dragging database objects from Server Explorer onto the Dataset Designer.
To create a new data table with TableAdapter
Open your dataset in the Dataset Designer. For information, see.
Drag a TableAdapter from the DataSet tab of the Toolbox onto the Dataset Designer.
The TableAdapter Configuration Wizard opens.
Complete the wizard. For more information, see
To create a new data table with a TableAdapter from Server Explorer
Open your dataset in the Data Source Designer.
Drag a database object (for example, a table) from Server Explorer onto the Dataset Designer.
Creating a Standalone DataTable
Standalone tables need to have Fill logic implemented in order to be filled with data. For information on filling standalone data tables, see.
To create a new stand alone data table
Open your dataset in the Dataset Designer.
Drag a DataTable from the DataSet tab of the Toolbox onto the Dataset Designer.
Add columns to define your data table. For more information, see.