Readme_Storefront

[This topic is pre-release documentation and is subject to change in future releases. Blank topics are included as placeholders.]

This sample works only with SQL Server 2005 and SQL Server 2008. It will not work with any version of SQL Server earlier than SQL Server 2005.

The Storefront sample for the Adventure Works Cycles sample database in SQL Server demonstrates how to build a simple Internet retail application by using SQL Server, ADO.NET, and ASP.NET. This document describes how to install the SQL Server version of the sample application.

This sample works with the AdventureWorks2008R2 sample database, which is included with SQL Server. Updates for both the database and this sample are available to download at the CodePlex Web site.

Samples are provided for educational purposes only. They are not intended to be used in a production environment and have not been tested in a production environment. Microsoft does not provide technical support for these samples. Sample applications and assemblies should not be connected to or used with your production SQL Server database or your report server without the permission of the system administrator.

The default installation directory is C:\Program Files\Microsoft SQL Server\100\Samples\Integrated Samples\Storefront\.

Scenario

A developer wants to implement an e-commerce Web site. The Web site should offer additional product recommendations based on the contents of the shopping cart (product up sell).

Languages

Transact-SQL, XML, XSD, Visual C#, and Visual Basic.

Features

The Storefront sample uses the following features of SQL Server:

Application Area Features

Demographics

XML, XSD

Globalization

Common language runtime user-defined function, common language runtime user-defined type

Overall

ADO.NET, Transact-SQL, AdventureWorks2008R2 sample database

Prerequisites

Before running this sample, make sure that SQL Server is installed, including the following components:

  • SQL Server Database Engine
  • SQL Server Management Studio
  • AdventureWorks2008R2 SP1 sample database
  • Database Engine Samples
  • The AdventureWorks2008R2 CLR sample. By default, this is placed in C:\Program Files\Microsoft SQL Server\100\Samples\Engine\Programmability\CLR\AdventureWorks when you install Database Engine Samples. See the readme file for this sample for additional installation instructions.

Building the Sample

If you have not already created a strong name key file, generate the key file using the following instructions.

To generate a strong name key file

  1. Open a Microsoft Visual Studio 2005 command prompt. Click Start, point to All Programs, point to Microsoft .NET Framework SDK 2.0, and then click SDK Command Prompt.

    -- or --

    Open a Microsoft .NET Framework command prompt. Click Start, point to All Programs, point to Microsoft .NET Framework SDK 2.0, and then click SDK Command Prompt.

  2. Use the change directory command (CD) to change the current directory of the command prompt window to the folder where the samples are installed.

    Note

    To determine the folder where samples are located, click the Start button, point to All Programs, point to Microsoft SQL Server, point to Documentation and Tutorials, and then click Samples Directory. If the default installation location was used, the samples are located in <system_drive>:\Program Files\Microsoft SQL Server\100\Samples.

  3. At the command prompt, run the following command to generate the key file:

    sn -k SampleKey.snk

    Important

    For more information about the strong-name key pair, see "Security Briefs: Strong Names and Security in the .NET Framework" in the .NET Development Center on MSDN.

To build the sample, do the following:

Step 1: Install the sample and configure IIS

  1. Alter the permissions of the folder where this sample is installed so it may be accessed by the user under which IIS runs. See the default installation directory above for the location of this folder. By default IIS runs under machinename\ASPNET for IIS 5.1 (Windows XP) and Network Service for IIS 6.0 (Windows 2003).

  2. If you intend to compile by using MSBuild instead of Visual Studio, create the StoreCSVS v-root if it does not already exist by performing the following steps:

    1. Right-click the StoreCSVS folder in C:\Program Files\Microsoft SQL Server\100\Samples\Integrated Samples\Storefront\CS\ and select Properties.
    2. In the StoreCSVS Properties page, go to the Web Sharing tab and select Share this folder.
    3. On the Edit Alias page, make sure Read is selected as the default Access permission and Script is selected as the default Application permission, and then click OK.
  3. If you have not already enabled the Default.aspx page on this server, you can do so by performing the following steps:

    1. Open Internet Information Services (IIS) Manager and expand the local computer in the explorer in the left pane.
    2. Right-click StoreCSVS and click Properties. StoreCSVS should be listed under Default Web Site in Web Sites. If you have left IIS Manager open from a previous step, you might need to click Action and then click Refresh to see the newly added v-root.
    3. Ensure that the ASP.NET version selected for the StoreCSVS virtual directory is 2.0.xxxxx where xxxxx is the build version.
    4. On the StoreCSVS Properties page, click the Documents tab, and then select Enable default content page. If Default.aspx is not listed as a content page, click Add.
    5. On the Add Content page, type Default.aspx, click OK, and then click OK again.

Step 2: Build the sample

  1. In Visual Studio

    1. Open the CS\StoreCSVS.sln solution file.
    2. On the Build menu, click Rebuild Solution.
  2. If you do not have Visual Studio, you can use MSBuild, which is distributed with the .NET Framework SDK 2.0

    1. Open a .NET Framework SDK 2.0 command prompt window.
    2. Change the directory to the Storefront sample directory.
    3. Run this command:
      msbuild /property:configuration=debug CS\StoreCSVS.sln

Step 3: Configure SQL Server

  1. Install the Storefront sample stored procedures by running the AWStore.sql script file. You can do this either by using Management Studio or by using the sqlcmd utility. The script file is located in the Scripts directory.

    1. To run the script file by using Management Studio, on the File menu, click Open, locate the Scripts folder, select the AWStore.sql file, and then run the contents of the file.
    2. To run the script file by using the sqlcmd utility, at the command prompt, change the directory to the folder where the AWStore.sql file is located, and then run the following command: sqlcmd -E -I -i awstore.sql

Step 4: Enable the OLAP-based product upsell scenario

  1. Open the Analysis Services project in <drive>:\Program Files\Microsoft SQL Server\100\Tools\Samples\AdventureWorks Analysis Services Project\Adventure Works.sln.

  2. Deploy the project.

  3. In Management Studio, click Connect in Object Explorer, and then click Analysis Server.

  4. Click Connect in the dialog box that appears.

  5. Right-click the new top level Analysis Server node that is displayed in the Object Explorer tree control. The node will be similar to COMPUTERNAME. In Analysis Services, the node will be similar to Domain\User.

  6. Click Properties.

  7. Click the Security page.

  8. Click Add.

  9. Type NETWORK SERVICE.

  10. Click OK twice.

Running the Sample

To run the sample, do the following:

Step 1: Browse the Web site

  1. Open Internet Explorer and type https://localhost/storecsvs in the address bar. With this application, you can perform a variety of real-world Web application tasks, including the following:

    • Browse the tree control of the product categories.
    • Find out what products are offered and available.
    • Register a fictitious user on the system, including adding fictitious demographic information.
    • Add items to your shopping cart.
    • Go through the checkout process.
    • View previously completed orders using the account icon.
    • Use the Services icon to browse Web services, or the Search text box to find products.

Step 2: Modify the installed sample and recompile (Optional)

  1. Remove the reference to the StoreClientComponents DLL and PDB files from the bin folder for the Web site.

  2. Add the reference to the StoreClientComponents DLL by selecting the Web site project, and then using the Web Site/References menu item.

  3. Save the project.

  4. Delete the StoreCSVS folder and its contents from the Temporary ASP.NET Files folder by using the following procedure:

    1. Exit Visual Studio 2005.
    2. Stop IIS.
    3. Delete the StoreCSVS folder from the drive:\WINNT\Microsoft.NET\Framework\v2.0.xxxxx\Temporary ASP.NET Files folder.
    4. Empty the Recycle Bin.
    5. Start IIS.

It is not necessary to recompile the sample to run it.

Removing the Sample

To remove the sample, do the following:

Remove the sample

  1. Open the Scripts\cleanup.sql file in Management Studio and run the contents of the file.

Comments

The common language runtime for SQL Server must be enabled for this sample to run correctly.

See Also

Concepts

SQL Server End-to-End Samples

Help and Information

Getting SQL Server 2008 R2 Assistance