Demographics Page

Description: The demographics page captures additional information about the customer who has just registered a new account at the web site. This demographic information is stored in the database as an XML document.

Microsoft® SQL Server™ 2005 provides XML typed columns. Data stored in these colums must be XML documents. These documents can be arbitrary well-formed XML, or they may be contrained to only contain documents which match a particular XML schema. XML Schemas may also be stored in the database to enable an XML column to reference a particular XML schema.

In the Adventure Works Cycles Storefront sample, after initial registration is complete, the user is asked a series of questions (birthday, family information, hobbies, etc.). This demographic information is then stored in the database as an XML document. This information could then be used for various Business Intelligence scenarios.

Implementation Notes: The AdventureWorks database defines an Individual table with an XML typed column called Demographics. The database also defines the XML Schema for the http://schemas.adventure-works.com/Individual/Survey namespace. The Demographics column is restricted to only contain XML documents which comply with Survey schema. The demographics.aspx web form captures the demographic information from the user, and the code in the Demographics.aspx.cs, CustomerDB.cs, and the usp_CustomerAddSurvey stored procedure create the XML and store it into the Demographics column for the appropriate row in the Individual table. Finally, the browser is redirected back to the shopping cart implemented by the ShoppingCart.aspx page.