Certified ASP.NET Programmer Learning Resources Adding a table to the database

Learning Resources
 

Adding a table to the database


To add a table to a database

  1. In the Data Connections section of the Server Explorer window, double-click (or expand) the database to which you want to add a table.

  2. Right-click the Tables folder and select Add New Table.

    The focus moves to the table definition panel for a new table.

  3. Add table columns, and specify the column name and data type of the new column, as well as whether the column allows nulls.

  4. Select the primary-key column (or press SHIFT+SELECT to select multiple columns for a multi-column primary key), right-click the selection, and then click Set Primary Key.

  5. Optionally, select an int (integer) column to specify as an identity column; and then, in the Column Properties panel for the column, double-click the Identity Specification section for the column and set (Is Identity) to Yes.

  6. Press CTRL+S to supply a table name and save the table. If you close the table definition panel without saving the table, you will be prompted to supply a table name, and the table will be automatically saved.

To add data to a table in a database

  1. In the Data Connections section of the Server Explorer window, double-click (or expand) the database that you want to work with and then double-click the Tables folder for that database.

  2. Right-click the table to which you want to add data and then click Show Table Data.

  3. In the data grid that appears, type the data that you want to place in the table, providing values for all of the required fields.

  4. When you are finished, select the next new row of the data grid. Visual Web Developer now writes the values for the populated row to the table.

 For Support