Previous in Contents Next in Contents

Content.Datasource Method

Note  The Content object is included in Commerce Server 3.0 only for backward compatibility with sites created in Commerce Server 2.0. New sites should be constructed using ADOs. Connection strings (not DSNs) should be stored in the ConnectionStringMap (part of the site dictionary) and queries should be stored in the QueryMap Dictionary object.

The Datasource method returns a Datasource object for the specified DSN variable. The DSN parameter references a DSN variable added to the Content object cache through a previous call to AddDatasource.

Syntax

Content.Datasource(DSN)

Parameters

DSN
A string that identifies the variable name associated with a DSN through a previous call to AddDatasource.

Example

The following example, from the Clocktower sample site, creates a Content object, adds a DSN variable to the object, and then uses the Datasource method to create a Datasource object instance for that DSN:

REM -- Create a content object and datasource for connection to the database
Set  MSCSContent = Server.CreateObject( "Commerce.Content" )
Call MSCSContent.AddDatasource("Clocktower", MSCSDSN)
Set  MSCSDatasource = MSCSContent.Datasource("Clocktower")

You can also use the variable name of the Content object to retrieve a Datasource object, as follows:

Set MSCSDatasource = MSCSContent("Clocktower")

© 1997-2000 Microsoft Corporation. All rights reserved.