Previous in Contents Next in Contents

DBStorage.LookupData Method

The LookupData method retrieves a single row from the data source based upon column names and values that you specify. If the data is found, this method creates and returns an OrderForm or Dictionary object (depending on the ProgID parameter passed to the InitStorage method) containing the requested data.

Syntax

DBStorage.LookupData(Null, Column, Value)

Parameters

Null
This parameter is required for compatibility with Commerce Server 2.0, but is not used.
Column
An array containing the column names that you want to query.
Value
An array containing the values that you want to query.

Remarks

The Column and Value arrays that you pass to LookupData share an index-to-index relationship. This means that they must contain an identical number of members and that the value stored in Value(N) will be searched for in the column specified by Column(N).

If the arrays contain more than one element, LookupData searches for a row in which all of the column/value pairs match.

Because the LookupData method returns only a single row of data, specifying column and value information that would result in the retrieval of more than one row results in an error.

Example

In the following sample, LookupData searches for a row in which both the shopper_id column contains the value returned by the shopper_id variable and the shopper_name column contains the customer name returned by the Page.Request method:

REM Attempt to determine if this shopper is already registered.
shopper_id = Page.GetShopperID

On Error Resume Next
Dim keys(1)
Dim values(1)
keys(0) = "shopper_id"
keys(1) = "shopper_name"
values(0) = shopper_id
values(1) = Page.Request("shopper_name", Null, 1, 60)

exists=NULL
set exists = MSCSStorage.LookupData(Null, keys, values)
If IsNull(exists) Then
REM This shopper id and name does not exist in the specified columns

Related Topics


© 1997-2000 Microsoft Corporation. All rights reserved.