Home > Articles > Programming > Windows Programming

  • Print
  • + Share This
This chapter is from the book

Database References

A database reference is a pointer to a database. However, this reference doesn't allow you to access and view the database objects—that's the job of the database connection.

A database reference is stored as part of the database project that is saved to disk. Whenever the project is opened, the project scans the list of database connections currently defined in the Server Explorer to see if a connection to the referenced database already exists. If such a connection doesn't exist, the database project automatically creates one.

The first database reference added to a project becomes the default reference for the project. That is, unless specified otherwise, the scripts and queries that will be designed and/or run will be against that database reference.


The icon for a database reference is a shortcut icon on top of a database icon. For the default database reference, the shortcut icon is red, green, and white. For the other references, the shortcut icon is black and white.


You can change the default reference for the project by right-clicking on the reference that you would like to be the default and selecting Set as Project Default from the context menu displayed.

You can add database references by right-clicking on the Database References node and selecting New Database Reference from the context menu displayed.


You can add another database reference and make it the default all at once. Right-click on the database project name (main node) in the Solution Explorer and then select the Set Default Reference menu item from the displayed context menu. Doing so displays the Set Default Reference dialog box. If you choose a database connection from the list of connections, it is added to the project and set to be the default database reference.

  • + Share This
  • 🔖 Save To Your Account