Udostępnij za pośrednictwem


How to: Manage Tables in a Database (Devices)

The following steps assume that you have a SQL Server Compact 3.5 database available in Server Explorer. For more information, see How to: Create a Database (Devices).

Note

Your computer might show different names or locations for some of the Visual Studio user interface elements in the following instructions. The Visual Studio edition that you have and the settings that you use determine these elements. For more information, see Visual Studio Settings.

To add a table

  1. On the View menu, click Server Explorer.

  2. In Server Explorer, expand the data connection to which you want to add a table.

  3. Right-click Tables, and then click Create Table.

  4. In the New Table dialog box, type a table name in the Name box.

  5. For the first column, enter values for Column Name, Data Type, Length, Allow Nulls, Unique, and Primary Key. Continue for additional columns.

  6. Click OK.

    The new table is displayed in the list of tables for the data connection.

To modify an existing table schema

  1. On the View menu, click Server Explorer.

  2. In Server Explorer, expand the data connection where the table schema to be edited is found.

  3. Right-click the table to be edited, and then click Edit Table Schema.

  4. In the Edit Table <Tablename> dialog box, make the changes, and then click OK.

To remove a table

  1. On the View menu, click Server Explorer.

  2. In Server Explorer, expand the data connection from which you want to drop a table.

  3. Under Tables, right-click the table you want to delete, and then click Drop Table.

  4. In the Delete Objects dialog box, click Remove, and then click OK.

    Note

    You cannot remove a table until all references to the table are deleted.

See Also

Concepts

Using SQL Server Compact 3.5 Databases (Devices)

Other Resources

New Table

Edit Table

Table Properties