共用方式為


IDTSComponentMetaDataCollection100.New 方法

Creates a new IDTSComponentMetaData100 object and adds it to an IDTSComponentMetaDataCollection100 collection.

命名空間:  Microsoft.SqlServer.Dts.Pipeline.Wrapper
組件:  Microsoft.SqlServer.DTSPipelineWrap (在 Microsoft.SqlServer.DTSPipelineWrap.dll 中)

語法

'宣告
Function New As IDTSComponentMetaData100
'用途
Dim instance As IDTSComponentMetaDataCollection100 
Dim returnValue As IDTSComponentMetaData100 

returnValue = instance.New()
IDTSComponentMetaData100 New()
IDTSComponentMetaData100^ New()
abstract New : unit -> IDTSComponentMetaData100
function New() : IDTSComponentMetaData100

傳回值

型別:Microsoft.SqlServer.Dts.Pipeline.Wrapper.IDTSComponentMetaData100
The newly created IDTSComponentMetaData100 object.

備註

Data flow components are added to the MainPipe class by calling the New method of the ComponentMetaDataCollection.

範例

The following code example adds an OLE DB Source component to a data flow task by calling the New method of the MainPipe class.

using System;
using Microsoft.SqlServer.Dts.Runtime;
using Microsoft.SqlServer.Dts.Pipeline.Wrapper;

namespace Microsoft.Samples.SqlServer.Dts
{
    class CreateComponent
    {
         [STAThread]
        static void Main(string[] args)
        {
            // Create the package.
            Package p = new Package();

            // Add the data flow task to the package.
            MainPipe dataFlowTask = ((TaskHost)p.Executables.Add("DTS.Pipeline.1")).InnerObject as MainPipe;

            if (dataFlowTask != null)
            {
                // Add a component to the data flow task.
                IDTSComponentMetaData100 metaData = dataFlowTask.ComponentMetaDataCollection.New();

                // Set the class ID of the component.
                metaData.ComponentClassID = "DTSAdapter.OLEDBSource.1";

                // Create an instance of the component.
                CManagedComponentWrapper wrapper = metaData.Instantiate();

                // Initialize the component.
                wrapper.ProvideComponentProperties();
            }
        }
    }
}

請參閱

參考

IDTSComponentMetaDataCollection100 介面

Microsoft.SqlServer.Dts.Pipeline.Wrapper 命名空間