Udostępnij za pośrednictwem


How to: Create a Database Project

You can create a database project in Solution Explorer as a convenient place to store SQL scripts and connections, and to handle versioning using Visual SourceSafe. For example, when you create a database project and establish database references, that connection information is saved as part of the project. Then, when you reopen the project, the database connection information is already established.

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 create a database project

  1. From the File menu, click New Project.

  2. Expand the Other Projects folder, and click Database Projects.

  3. Under Templates click Database Project.

  4. Enter the name for your new project and select a directory location.

  5. Choose either Add to Solution (to add the database project to the currently open solution), or Create New Solution, and click OK.

  6. If you already have at least one database connection established in Server Explorer, the Add Database Reference dialog box appears. Select one of the existing database connections. This finalizes you project.

    If there are no existing database connections, the New Database Reference dialog box appears. Create a connection following the steps in How to: Connect to a Database from Server Explorer.

Your connection appears in Solution Explorer under Database References and in Server Explorer under the Data Connections node.

See Also

Reference

Add/Modify Connection Dialog Box (General)

Other Resources

Working with Database Projects