DtsProperty.GetValue(Object) 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
返回房产价值。
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 连接管理器,并且你为其属性创建DtsProperty了一个对象,那么你会将连接管理器对象作为参数传递给方法GetValue。ServerName