How to: Set Up the Northwind Sample Database for ASP.NET Development

This topic describes how to install and connect to the Northwind sample database when you create ASP.NET Web applications. Because the Northwind sample databases are used with some code examples and sample applications, it is helpful to have an instance of the sample database available in your development environment.


The Northwind sample database has been superseded by the AdventureWorks database, which includes new and updated features to illustrate SQL Server capabilities. The information in this topic is provided in order to support existing documentation that references the Northwind database.

This topic describes how to perform the following tasks:

  • How to download and install the Northwind sample database package.

  • How to connect to the Northwind database in an ASP.NET Web application in Visual Studio.

In order to complete the procedures that are described in this topic, you will need:

  • Visual Studio 2008 with Service Pack 1 installed, Visual Web Developer 2008 Express Edition with SP1, or later versions of these products.

  • A local instance of SQL ServerĀ or SQL Server Express. A basic edition of SQL Server 2008 Express is included with Visual Studio 2008 and later versions. To download a more advanced version of SQL Server 2008 Express that includes tools, services, and full-text search, see Microsoft SQL Server Express 2008 with Advanced Services on the Microsoft download Web site.

Installing the Database

To install the Northwind sample database

  1. In a browser, visit the Northwind and pubs Sample Databases for SQL Server 2000 page on the MSDN Web site.


    The sample databases were created for SQL Server 2000, but you can use them in later versions of SQL Server.

  2. Click the Download button and save the SQL2000SampleDb.msi file to a local folder on your computer.

  3. After the download has finished, double-click the SQL2000SampleDb.msi file to begin the installation process.

    The installation process installs the Northwind and pubs database files (.mdf and .ldf files) in the following folder:

    <drive>\SQL Server 2000 Sample Databases

Adding a Database Instance to a Web Application

After the installation process for the database has completed, you can add a connection to the database in Visual Studio. You can use this connection with any kind of ASP.NET Web site, service, or project that can use a data connection.

To add a database file to a Web site or project

  1. Open the project that you want to add the database to.

  2. If the project does not contain an App_Data folder, in Solution Explorer, right-click the project name, click Add ASP.NET Folder, and then click App_Data.

  3. In Solution Explorer, right-click the App_Data folder, and then click Add Existing Item.

    The Add Existing Item dialog box is displayed.

  4. Browse to the folder that contains the .mdf file for the Northwind database that you want to use, select the *.mdf file, and then click Add.


    In order to find the .mdf file, you might have to change the file types that the dialog box displays.

    This creates a copy of the database and adds it to your Web site or project.

See Also


Walkthrough: Creating a New Dynamic Data Web Site Using Scaffolding

Other Resources

ASP.NET Data Access Content Map

Using SQL Server Compact for ASP.NET Web Applications