共用方式為


DtsProperty.Name Property

Returns the name of the property. This field is read-only.

命名空間: Microsoft.SqlServer.Dts.Runtime
組件: Microsoft.SqlServer.ManagedDTS (in microsoft.sqlserver.manageddts.dll)

語法

'宣告
Public ReadOnly Property Name As String
public string Name { get; }
public:
property String^ Name {
    String^ get ();
}
/** @property */
public String get_Name ()
public function get Name () : String

屬性值

A String that contains the name.

範例

This object is used in the DtsProperties collection, which contains information about each property in various objects in which it is implemented, including the Package object. The example below returns a DtsProperties collection for a package, and then iterates through the package properties, displaying several values, including Name.

// other Using statements here...
using Microsoft.SqlServer.Dts.Runtime;
namespace DtsPropertiesTesting
{
class Program
    {

        static void Main(string[] args)
        {
            // The variable pkg points to the location
            // of the ExecuteProcess package sample 
            // that is installed with the samples.
            string packageFile = @"C:\Program Files\Microsoft SQL Server\90\Samples\Integration Services\Package Samples\ExecuteProcess Sample\ExecuteProcess\UsingExecuteProcess.dtsx";

            Application application = new Application();
            Package package = application.LoadPackage(packageFile, null);

            // Retrieve the information from the Properties collection.
            // Each item in the collection represents a property on the
            // Package object.

            DtsProperties properties = package.Properties;

            String propertyName;
            DTSPropertyKind propertyKind;
            String packagePath;
            TypeCode propertyType;

            foreach (DtsProperty property in properties)
            {
                propertyType = property.Type;
                propertyName = property.Name;
                propertyKind = property.PropertyKind;
                packagePath = property.GetPackagePath(package);
                Console.WriteLine("Property Type: {0}, Property Name: {1}, Property Kind: {2}, Package Path: {3} ", propertyType, propertyName, propertyKind, packagePath);
            }
        }
    }
}
' other Using statements here...
Imports Microsoft.SqlServer.Dts.Runtime
Namespace DtsPropertiesTesting
Class Program
 
        Shared  Sub Main(ByVal args() As String)
            ' The variable pkg points to the location
            ' of the ExecuteProcess package sample 
            ' that is installed with the samples.
            Dim packageFile As String =  "C:\Program Files\Microsoft SQL Server\90\Samples\Integration Services\Package Samples\ExecuteProcess Sample\ExecuteProcess\UsingExecuteProcess.dtsx" 
 
            Dim application As Application =  New Application() 
            Dim package As Package =  application.LoadPackage(packageFile,Nothing) 
 
            ' Retrieve the information from the Properties collection.
            ' Each item in the collection represents a property on the
            ' Package object.
 
            Dim properties As DtsProperties =  package.Properties 
 
            Dim propertyName As String
            Dim propertyKind As DTSPropertyKind
            Dim packagePath As String
            Dim propertyType As TypeCode
 
            Dim property As DtsProperty
            For Each property In properties
                propertyType = property.Type
                propertyName = property.Name
                propertyKind = property.PropertyKind
                packagePath = property.GetPackagePath(package)
                Console.WriteLine("Property Type: {0}, Property Name: {1}, Property Kind: {2}, Package Path: {3} ", propertyType, propertyName, propertyKind, packagePath)
            Next
        End Sub
End Class
End Namespace

Sample Output:

Property Type Int64, name CertificateContext, Property Kind Other, Package path \Package.CertificateContext

Property Type Object, name CertificateObject, Property Kind Other, Package path \Package.CertificateObject

Property Type String, name CheckpointFileName, Property Kind Other, Package path \Package.CheckpointFileName

Property Type Object, name CheckpointUsage, Property Kind Other, Package path \Package.CheckpointUsage

Property Type Boolean, name CheckSignatureOnLoad, Property Kind Other, Package path \Package.CheckSignatureOnLoad

Property Type Object, name Configurations, Property Kind Other, Package path \Package.Configurations

Property Type Object, name Connections, Property Kind Other, Package path \Package.Connections

Property Type DateTime, name CreationDate, Property Kind Other, Package path \Package.CreationDate

Property Type String, name CreationName, Property Kind Other, Package path \Package.CreationName

執行緒安全性

Any public static (Shared in Microsoft Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

平台

開發平台

如需受支援的平台清單,請參閱<安裝 SQL Server 2005 的硬體和軟體需求>。

目標平台

如需受支援的平台清單,請參閱<安裝 SQL Server 2005 的硬體和軟體需求>。

請參閱

參考

DtsProperty Class
DtsProperty Members
Microsoft.SqlServer.Dts.Runtime Namespace