Previous in Contents Next in Contents

SimpleDBDS Read-only Path and Methods

The Directory Services path for read-only access is expressed in the format:

SimpleDBDS://RO/ConnectionString/SQL Statement/[KeyType]/[KeyValue]

where:

RO
Indicates read only.
ConnectionString
A connection string for the data source, specified as a string Variant.
SQL Statement
A SQL query. The query may contain up to one ? character. The query must use a primary key so that it returns no more than one row in the database table.
KeyType
Optional. The data type of the KeyValue. If not specified, the default is string. The / separator is not optional. Usually keys are strings or long integers, but any of the following types may be used.
KeyType specifier Data type of KeyValue specifier
string String (default)
long 32-bit long integer
integer 16-bit integer
single Single-precision floating-point number
double Double-precision floating-point number
currency Currency
date Date

KeyValue
Optional. The value for the ? in the SQL query. If the path does not include a ? in the SQL query, a Key Value should not be provided. The / separator is not optional.

Example

The following example creates a read-only ADSI provider that uses the connection string "DSN=cs; UID=sa;PWD=", and queries the Clocktower product database using a given SKU (Lor-842W) as a query argument. The example uses the property of the ADSI provider object to display values in a page:

<%
Set CurrentNode = GetObject("SimpleDBDS://RO/DSN=cs;UID=sa;PWD=/select sku, name, dept_name from clocktower_product,  clocktower_dept where clocktower_product.dept_id = clocktower_dept.dept_id and sku = ?//Lor-842W")

Response.Write("<br>Name: ")
Response.Write(CurrentNode.Name)

Response.Write("<br>ADsPath: ")
Response.Write(CurrentNode.ADsPath)

Response.Write("<br>Parent: ")
Response.Write(CurrentNode.Parent)

Response.Write("<br>sku: ")
Response.Write(CurrentNode.Get("sku"))

Response.Write("<br>name: ")
Response.Write(CurrentNode.Get("name"))

Response.Write("<br>dept_name: ")
Response.Write(CurrentNode.Get("dept_name"))
%>

The previous script produces the following output:

Name: RO/DSN=cs;UID=sa;PWD=/select sku, name, dept_name from clockped_product, clockped_dept where clockped_product.dept_id = clockped_dept.dept_id and sku = ?//Lor-842W
ADsPath: SimpleDBDS://RO/DSN=cs;UID=sa;PWD=/select sku, name, dept_name from clockped_product, clockped_dept where clockped_product.dept_id = clockped_dept.dept_id and sku = ?//Lor-842W
Parent: SimpleDBDS:
sku: Lor-842W
name: Primrose Wall Clock
dept_name: Wall Clocks

Note  The methods of the SimpleDBDS object are not usually used directly by ASP in a Commerce Server site. Instead, the AUO is configured to use SimpleDBDS as an ADSI provider, and the AUO is used to access customer information.

The read-only SimpleDBDS supports the following ADSI properties.

Property Description
Name Portion of the path following "SimpleDBDS://".
ADsPath ADSI path.
Parent Name of the ADSI provider, in this case SimpleDBDS.

The read-only SimpleDBDS supports the following methods.

Method Description
GetInfo Reloads the object with property values that exist in the metabase.
Get Retrieves value for a named property from the object.
GetEx Retrieves value(s) for a named single-valued or multi-valued property of the object.


© 1997-2000 Microsoft Corporation. All rights reserved.