The database project is a special type of Visual Studio.NET project. Its purpose is to create and manage SQL database scripts. Creating a VS.NET database project is the first step in utilizing the database management tools available in VS.NET. This excerpt from InformIT explains how to create a database project in seven simple steps.
A special type of VS.NET project of particular interest is the database project. A database project is not specific to any .NET programming language, such as Visual Basic or C#, but is meant to be used to design, test, run and manage SQL scripts and queries. When you design your application in multiple layers, as you should, this project type helps you to develop and manage the database layer closest to the database and the database itself.
In some applications, a database project may be part of the actual application code, and in other applications it may be part of a separate administration solution used to set up and maintain the application's database.
To add a new database project to a solution, do the following.
- Launch the Add New Project dialog from either the main File menu or from the context menu displayed by right-clicking on the solution in the Solution Explorer.
- The left panel of this dialog box displays a list of folders containing different project types. Expand the Other Projects folder (click on the "+").
- Select the Database Projects folder. It displays a Database Project template in the right panel of the dialog box.
- Specify a project name and a path for saving the project files and then click on the OK button.
- If you don't currently have any database connections defined in the Server Explorer, the Data Link Properties dialog box will be displayed, allowing you to define a new database connection.
- If you have at least one database connection defined in the Server Explorer, the Add Database Reference dialog box is displayed. From this dialog choose the database connection that you want to use (you can add new ones later). Alternatively, you can click on the Add New Reference button to display the Data Link Properties dialog box, allowing you to define a new database connection.
- Select the connection to the appropriate database on the SQL Server and click on the OK button. If for some reason a connection doesn't exist, create it from the Data Link Properties dialog box.
Note that the created database project contains the following folders:
- Change Scripts
- Create Scripts
- Database References
Learn more about managing VS.NET database projects at InformIT.
Do you have comments on this tip? Let us know.