25.3. Walking through Some Examples

This may well be the messiest section in the entire book in terms of hearing me "talk" about things, as it includes a ton of Visual Studio stuff that goes well beyond what is built into the base SQL Server Business Intelligence Studio.

You must have some version of Visual Studio .NET in order to actually build these examples yourself. Not to fear, however, if you don't — I do show all the lines of code here, so you can at least look them over.

Also, the examples below are done in C#, but the basic object references and method calls are the same — conversion to VB or C++ should be simple for those more comfortable in those languages.

What we're going to be doing in this section is building up a little application that does a number of different "basics" that you might be interested in. Among the things that will happen at least once among all these various actions are:

  • Creating a reference to a specific server, including a connection to a server using a trusted connection

  • Creating an entirely new database

  • Creating tables in a database

  • Creating primary key constraints for those tables

  • Creating a foreign key referencing from one table to another

  • Dropping a database

  • Backing up a database

  • Scripting a database object

Each of these is a hyper-simplified version of what is required. Keep in mind that each of the objects I reference here has many more possible properties and methods to be set. For example, in the scripting example, we could play around with ...

Get Professional SQL Server™ 2005 Programming now with O’Reilly online learning.

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