C.3 Adding the Northwind Data

When first installed, MSDE doesn't contain any data except the standard set of system tables such as master, model, msdb, and tempdb. Fortunately, the .NET framework includes SQL scripts to install several sample databases:

  • The Northwind database: instnwnd.sql

  • The pubs database: instpubs.sql

  • The IBuySpy portal database: portal.sql

Look for these files in a directory such as C:\Program Files\Microsoft Visual Studio .NET\FrameworkSDK\Samples\Setup. The instnwnd.sql installs the database, tables, and sample rows you need to run all the examples in this book. To install it, you can use the OSQL command-line utility.

Here's the code required to install the Northwind table to the instance of MSDE that is installed with Visual Studio .NET (assuming the instnwnd.sql file is in the current directory).

osql -E /i instnwnd.sql

Alternatively, you can use SQL authentication with the -U parameter:

osql -U sa /i instnwnd.sql

If MSDE is installed on another computer, or if your computer also has SQL Server installed, you must explicitly identify the MSDE instance you want to use by adding the -S parameter. The following command assumes you are using the version of MSDE installed with Visual Studio .NET:

osql -S serverName\VSdotNET -E /i instnwnd.sql

    Part I: ADO.NET Tutorial
    Part II: ADO.NET Core Classes
    Part III: API Quick Reference