IDTSComponentMetaData100.GetComponentView 方法

定義

public:
 Microsoft::SqlServer::Dts::Pipeline::Wrapper::Sql2014::IDTSComponentView100 ^ GetComponentView();
[System.Runtime.InteropServices.DispId(119)]
public Microsoft.SqlServer.Dts.Pipeline.Wrapper.Sql2014.IDTSComponentView100 GetComponentView();
[<System.Runtime.InteropServices.DispId(119)>]
abstract member GetComponentView : unit -> Microsoft.SqlServer.Dts.Pipeline.Wrapper.Sql2014.IDTSComponentView100
Public Function GetComponentView () As IDTSComponentView100

傳回

元件 IDTSComponentView100 介面。

屬性

範例

以下程式碼範例展示了 GetComponentView 方法的使用方式。

Imports System   
Imports Microsoft.SqlServer.Dts.Runtime   
Imports Microsoft.SqlServer.Dts.Pipeline.Wrapper   
Namespace Microsoft.Samples.SqlServer.Dts   

 Public Class Class1   

   Public Shared Sub Main(ByVal args As String())   
     Dim p As Package = New Package   
     Dim mp As MainPipe = CType(CType(p.Executables.Add("DTS.Pipeline").InnerObject, TaskHost), MainPipe)  
     Dim mdOleDbSrc As IDTSComponentMetaData100 = mp.ComponentMetaDataCollection.New   
     mdOleDbSrc.ComponentClassID = "DTSAdapter.OleDbSource"   
     mdOleDbSrc.Name = "OLEDB Source"   
     Dim oledbView As IDTSComponentView100 = mdOleDbSrc.GetComponentView   
     mdOleDbSrc.Name = "The OLEDB Source Component"   
     Console.WriteLine(mdOleDbSrc.Name)   
     oledbView.Cancel   
     Console.WriteLine(mdOleDbSrc.Name)   
   End Sub   
 End Class   
End Namespace  
using System;  
using Microsoft.SqlServer.Dts.Runtime;  
using Microsoft.SqlServer.Dts.Pipeline.Wrapper;  

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

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

            // Add the OLEDB Source component.  
            IDTSComponentMetaData100 mdOleDbSrc = mp.ComponentMetaDataCollection.New();  
            mdOleDbSrc.ComponentClassID = "DTSAdapter.OleDbSource";  
            mdOleDbSrc.Name = "OLEDB Source";  

            IDTSComponentView100 oledbView = mdOleDbSrc.GetComponentView();  

            mdOleDbSrc.Name = "The OLEDB Source Component";  

            Console.WriteLine(mdOleDbSrc.Name);  

            oledbView.Cancel();  

            Console.WriteLine(mdOleDbSrc.Name);  
        }  
    }  
}  
The following output is generated by the above code example.  
The OLEDB Source Component  
OLEDB Source  

備註

此方法用於擷取 IDTSComponentView100 元件的介面。 此介面允許對元件元資料進行交易性修改。 當呼叫該方法時,元件的元資料修改會被 Commit 持久保存,並在呼叫該 Cancel 方法時還原。

適用於