IV.4.2. Navigating an SQL Server Database with Visual Studio

One of the primary reasons you connect to an SQL Server database is to explore it. While exploring a database in Visual Studio you can

  • View the objects: This includes database objects, such as tables, views, stored procedures, functions, and more.

  • Modify data: By opening tables and views you can add, modify, and delete data in the database.

  • Execute, test, and debug stored procedures: If a stored procedure accepts input variables, you're prompted to provide the input. You can test the stored procedures capability of handling different inputs and enter the debugger if your stored procedure isn't functioning as desired.

By using the Server Explorer in Visual Studio, you can easily explore a database and see all the elements. It avoids the need to install SQL Server on a development system just to explore the database.

IV.4.2.1. Exploring tables and views from Visual Studio

The Visual Studio Solution Explorer works very similar to the Object Explorer in SQL Server Management Studio (SSMS). The best way to see this is by doing it.

While the following steps show you how to access a table, modify data in the table, and build a query, feel free to look around at any objects to see what you can do. As long as you're working with the AdventureWorks2008 database, the worst that can happen is the database could become corrupt, and you'd need to download another copy.

If you have any trouble connecting to the AdventureWorks2008 database, ...

Get Microsoft® SQL Server™ 2008 All-In-One Desk Reference For Dummies® now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.