Samples for XSB 1.0
Back to the main page for XSB 1.0
The component ships with a working ASP shopping solution (except the checkout, which you have to provide). It is based on the
Northwind Traders database that comes with SQL Server 7.0 (you can use the Access version too).
Please note that in the sample
code, the connection string is hardcoded and points to a database server named TOPGUN - you have to change that before it works.
The Products Page
The initial page simply displays a list of products (see Figure below). Data comes from the Products table in the Northwind
database (shipping with SQL Server 7.0 or Microsoft Access). The source code for this page is found in products.asp.
The Simple Shopping Bag
The code in products.asp creates a hyperlink to bag.asp, which is used to add products to the shopping bag for the current
customer (in the ZIP file, the file is named bagxml.asp - it is included for demonstration purposes only).
This code adds products only and uses the XML viewing capabilities of Internet Explorer 5.0 or higher to display the raw contents
of the shopping bag as created by xObj.SaveBag. Note that the text is encoded using Server.HtmlEncode to form valid XML.
You can use bagxml.asp to debug your shopping bag when you are using additional properties introduced by xObj.LineItems("item").SetValue(...).
The "Final" Shopping Bag
Raw XML isn't what you want to present to your customers - a pleasing interface for the shopping bag would be fine. This interface
is implemented in the final version of bag.asp, which is much more structured and can be easily adjusted to fit your needs in design
In addition to the user interface, it also has support for quantity changing, product removal and proceeding to the checkout.