Install SQL Ser ver and the Nor thwind Sample Data


To run the examples shown in this chapter, you must install either Microsoft SQL Server or one of its lightweight equivalents (SQL Express or MSDE).

While ADO.NET can work with many different database products, the details differ with the database used. The examples in this chapter and Chapter 25 are based on the Microsoft SQL Server database, except where a different database is specifically noted, so one of the first tasks is to install SQL Server!

Install SQL Express

Visual Studio 2005 includes a copy of SQL Express, the lightweight desktop engine version of SQL Server 2005. If you are familiar with previous versions of SQL Server, you may have known this lightweight version as the Microsoft SQL Desktop Engine (MSDE).

If you have already installed SQL Server 2000 or the desktop engine version of SQL Server 2000 (MSDE) on your system, you can use your existing installation and skip the following steps for installing SQL Express.

Note

Note that if you use your existing installation of SQL Server, you need to change the instance name as used in the examples from SQLExpress to the name of your server.

SQL Express is offered as one of the packages to install with VS2005, but is not checked by default. If you did not check the option to install SQL Express, you can install it by browsing to the directory:

    C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bootstrapper\Packages\ SqlExpress\en

Execute the installation executable in this location:

Sqlexpr32.exe

Be sure to check the client command-line tools in order to include osql.exe as part of the installation.

Install the Northwind Sample Database

The Northwind sample database for SQL Server is included with the Quickstart samples of Visual Studio 2005 in the .NET Framework v2.0 SDK samples setup area. If you did not select the Quickstart samples as one of the features to install, run the VS2005 setup again and select .NET Framework SDK Quickstart Samples.

To install the Northwind sample into your SQL Express instance after installing the Quickstart samples, execute a command prompt (Start Run cmd) and change directory to the samples setup area:

cd "C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Samples\Setup"

Assuming that you have installed SQL Express on your computer as noted earlier, run the osql utility (located in C:\Program Files\Microsoft SQL Server\90\Tools\Binn) to install the sample data:

osql -E -S (local)\sqlexpress -i instnwnd.sql
Note

the –E flag tells osql to use the built-in Windows security (your Windows login) as the SQL Server user. the –S flag identifies the name of the SQL Server, which consists of a server name and an instance name. The sqlexpress name is an instance name; you may have multiple versions of SQL Server running on one machine, identified by a unique instance name; sqlexpress is the default instance created by the SQL Express installation. The server name (local) is a generic name for a local server; that is, the SQL Server running on the same machine as osql or VS2005 (your desktop computer). You may substitute the actual name of your machine for (local); for example, my laptop is called roadrunner, so I could also invoke osql with –S roadrunner\sqlexpress, which would refer to the sqlexpress instance of SQL Server running on the machine named roadrunner.

This completes the installation of SQL Server (SQL Express) and the sample data needed for this chapter. Now let's go on to have some fun with Visual Studio 2005!




Beginning Visual C# 2005
Beginning Visual C#supAND#174;/sup 2005
ISBN: B000N7ETVG
EAN: N/A
Year: 2005
Pages: 278

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net