How to: Add Columns to a DataTable
The individual columns (DataColumn) that make up data tables (DataTable) are created by adding them to the data tables DataColumnCollection. You can add columns to data tables visually with the Dataset Designer, or with one of the data wizards. To add data columns to data tables programmatically, see Adding Columns to a DataTable (ADO.NET).
Note
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 Visual Studio Settings.
To add a column to a DataTable with the Dataset Designer
Open your dataset in the Dataset Designer. For more information, see How to: Open a Dataset in the Dataset Designer.
Right-click the DataTable to add the column. Point to Add, and then click Column.
Replace the default column name, if desired, by selecting the column name in the data table and editing the text.
Set the DataType property in the Properties window. For more information, see How to: Set the Data Type of a DataColumn.
To add a column to a DataTable with the Data Source Configuration Wizard
In the Data Sources window, right-click the data source, and then click Configure DataSet with Wizard.
Expand the table you want to add a column to.
Select the columns to add to the table.
Click Finish.
To add a column to a DataTable with the TableAdapter Configuration Wizard
Open your dataset in the Dataset Designer. For more information, see How to: Open a Dataset in the Dataset Designer.
Right-click the data table, and then click Configure.
Add the column to the SELECT statement.
Click Finish.
See Also
Tasks
Walkthrough: Displaying Data on a Form in a Windows Application
How to: Connect to Data in a Database
Concepts
Other Resources
Connecting to Data in Visual Studio
Preparing Your Application to Receive Data
Fetching Data into Your Application
Displaying Data on Forms in Windows Applications