The New method creates a new object for a collection from a ProgID or CLSID.
[Set object =] Collection.New( ID )
Part | Description |
---|---|
Collection | Expression that evaluates to an object in the Applies To list |
object | Object variable to receive reference to created object |
ID | ProgID or CLSID of object to be created |
The required type of object depends on the collection to which it is being added:
Collection | Object |
---|---|
Connections | Connection Object Connection2 Object |
Tasks | Task Object |
Transformations | Transformation Object Transformation2 Object |
The New method for the collections in the Applies To list creates a new object based on the ProgID or CLSID of the corresponding class. The New methods for other collections use different parameters and syntax.
There are version-dependent and version-independent forms of a ProgID. Typically, the version-dependent form looks like name.version. The version-independent form typically has name only, without the .version, although that form is not required. The version-independent form should be used unless you need a feature of a particular version.
HRESULT New(
BSTR bstrID,
ObjectInterface **RetVal);
To create a new connection using the Microsoft® OLE DB Provider for ODBC drivers in Microsoft Visual Basic®, use one of the following forms.
By version-independent ProgID:
Set objConnection = objPackage.Connections.New( "MSDASQL" )
By version-dependent ProgID:
Set objConnection = objPackage.Connections.New( "MSDASQL.1" )
By CLSID:
Set objConnection = _
objPackage.Connections.New( "{C8B522CB-5CF3-11CE-ADE5-00AA0044773D}" )