AddColumn Method

DTS Programming

DTS Programming

AddColumn Method

The AddColumn method creates a Column object by name and ordinal position and adds it to the collection.

Applies To
Columns Collection
Syntax

Columns.AddColumn Name,Ordinal

Part Description
Columns Expression that evaluates to a Columns collection
Name String that is the name of the column
Ordinal Long that is the ordinal position of the column

Remarks

The AddColumn method does not return a reference to the column object it creates. If you need to set Column properties other than Name and Ordinal, you can create the Column object with the New method, set the properties, and then add it to the collection with the Add method. Or, you can access the Column object from the collection after creating it with AddColumn.

Prototype (C/C++)

HRESULT AddColumn(
    BSTR Name,
    long Ordinal);

Example

This Microsoft® Visual Basic® sample accesses a Column object from the collection after creating it with AddColumn. The expression objTransform.SourceColumns evaluates to a Columns collection:

Dim objTransForm      As DTS.Transformation2
Dim objColumn         As DTS.Column
. . .
objTransForm.SourceColumns.AddColumn "LastName", 2
Set objColumn = objTransForm.SourceColumns( "LastName" )

See Also

Add Method

Adding DTS Column Objects

New (Columns) Method