AddLookup Method

DTS Programming

DTS Programming

AddLookup Method

The AddLookup method adds a parameterized query to the Lookups collection.

Applies To
Lookups Collection
Syntax

object.AddLookup Name, Query, ConnectionID, [MaxCacheRows]

Part Description
object Expression that evaluates to a Lookups collection
Name String that is the lookup query name
Query String that is the SQL query
ConnectionID Long that is the connection ID
MaxCacheRows Long that is the maximum number of rows to cache for reuse

Remarks

Typically, a Lookup object is referenced in a Microsoft® ActiveX® script. The Query is executed against the data source specified by the ConnectionID. The first row of the returned rowset is used. MaxCacheRows specifies the number of rows cached locally so that subsequent lookups that target that row do not need to reissue the query against the data source.

The AddLookup method does not return a reference to the Lookup object it creates. You also can create the Lookup object with the New method, set its properties, and then add it to the collection with the Add method.

Prototype (C/C++)

HRESULT AddLookup(BSTR Name,
    BSTR Query,
    long ConnectionID,
    long MaxCacheRows);

Example

This Microsoft Visual Basic® sample creates and adds a Lookup object to the collection:

   objDataPump.Lookups.AddLookup "ExpandState", _
      "SELECT StateName FROM StateInfo WHERE POCode = ?", _
      2, 50

See Also

Add Method

Adding DTS Lookups and Global Variables

Lookup Object

New (Name) Method