Creating a VS .NET database project

Jeffrey McManus and Jackie Goldstein

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.

  1. 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.
  2. The left panel of this dialog box displays a list of folders containing different project types. Expand the Other Projects folder (click on the "+").
  3. Select the Database Projects folder. It displays a Database Project template in the right panel of the dialog box.
  4. Specify a project name and a path for saving the project files and then click on the OK button.
  5. 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.
  6. 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.
  7. 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
  • Queries
  • Database References

Learn more about managing VS.NET database projects at InformIT.

Do you have comments on this tip? Let us know.

This was first published in May 2004

There are Comments. Add yours.

TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

Disclaimer: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.