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.
DBStorage.LookupData(Null, Column, Value)
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.
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