언어

DtsProperty.GetValue(Object) 메서드

정의

부동산 가치를 반환합니다.

public:
 System::Object ^ GetValue(System::Object ^ o);
public object GetValue(object o);
member this.GetValue : obj -> obj
Public Function GetValue (o As Object) As Object

매개 변수

o
Object

반환할 값을 반환할 속성의 부모 객체입니다.

반품

속성의 값을 포함하는 객체입니다.

예제

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

namespace DtsPropertyGetValueCS  
{  
  class Program  
  {  
    static void Main(string[] args)  
    {  
      Package testPackage;  
      ConnectionManager testConnection;  
      DtsProperty testProperty;  
      string propertyValue;  

      testPackage = new Package();  
      testConnection = testPackage.Connections.Add("OLEDB");  
      testConnection.ConnectionString = "Provider=SQLOLEDB;" +  
        "Data Source=(local);Initial Catalog=AdventureWorks;" +  
        "Integrated Security=SSPI";  
      testConnection.Name = "Test Connection Manager";  

      testProperty = testConnection.Properties["ServerName"];  
      propertyValue = testProperty.GetValue(testConnection).ToString();  

      Console.WriteLine("The value of ServerName is: " + propertyValue);  
      Console.Read();  

    }  
  }  
}  
Imports Microsoft.SqlServer.Dts.Runtime  

Module Module1  

  Sub Main()  

    Dim testPackage As Package  
    Dim testConnection As ConnectionManager  
    Dim testProperty As DtsProperty  
    Dim propertyValue As String  

    testPackage = New Package()  
    testConnection = testPackage.Connections.Add("OLEDB")  
    testConnection.ConnectionString = "Provider=SQLOLEDB;" & _  
      "Data Source=(local);Initial Catalog=AdventureWorks;" & _  
      "Integrated Security=SSPI"  
    testConnection.Name = "Test Connection Manager"  

    testProperty = testConnection.Properties("ServerName")  
    propertyValue = testProperty.GetValue(testConnection).ToString()  

    Console.WriteLine("The value of ServerName is: " & propertyValue)  
    Console.Read()  

  End Sub  

End Module  

설명

메서드를 GetValue 호출해 속성의 값을 요청하면, 매개변수로 전달해야 하는 객체가 그 속성이 속한 객체입니다. 예를 들어, 다음 예시에서 볼 수 있는 OLE DB 연결 관리자를 다루고 있고, 그 ServerName 속성에 맞는 객체를 만들 DtsProperty 었다면, 연결 관리자 객체를 메서드의 매개변수로 전달해야 합니다GetValue.

적용 대상