共用方式為


DtsProperty.Set Property

Returns a Boolean that indicates whether the referenced object property is changeable. This field is read-only.

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

語法

'宣告
Public ReadOnly Property Set As Boolean
public bool Set { get; }
public:
property bool Set {
    bool get ();
}
/** @property */
public boolean get_Set ()
public function get Set () : boolean

屬性值

This property returns true when the referenced object property is changeable and the property referenced is read/write or write-only. When false, the property referenced is read-only.

範例

The following code example creates a package and adds a Bulk Insert task. It then gets the Properties, and views the Get and Set property values along with the property name.

using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.SqlServer.Dts.Runtime;

namespace Executables_API
{
    class Program
    {
        static void Main(string[] args)
        {
            Package pkg = new Package();
            Executable exec = pkg.Executables.Add("STOCK:BulkInsertTask");

            // Obtain the collection.
            Executables pgkExecs = pkg.Executables;
            foreach (Executable eachExec in pgkExecs)
            {
                TaskHost th = exec as TaskHost;
                Console.WriteLine("Executable creation name is: {0}", th.CreationName);
            }
            
            // Show use of Contains.
            
            if (pgkExecs.Contains(0))
                {
                // Retrieve executable using [item] syntax.
                Executable execItem = pgkExecs[0];
                TaskHost thItem = execItem as TaskHost;
                DtsProperties myProps = thItem.Properties;
                foreach (DtsProperty dtsProp in myProps)
                {
                    Console.WriteLine("Name {0}, Get? {1} Set? {2}", dtsProp.Name, dtsProp.Get, dtsProp.Set);
                }
                Console.WriteLine("Contains returned true");
            }
            else
            {
                Console.WriteLine("Contains returned false");
            }
        }
    }
}
Imports System
Imports System.Collections.Generic
Imports System.Text
Imports Microsoft.SqlServer.Dts.Runtime
 
Namespace Executables_API
    Class Program
        Shared  Sub Main(ByVal args() As String)
            Dim pkg As Package =  New Package() 
            Dim exec As Executable =  pkg.Executables.Add("STOCK:BulkInsertTask") 
 
            ' Obtain the collection.
            Dim pgkExecs As Executables =  pkg.Executables 
            Dim eachExec As Executable
            For Each eachExec In pgkExecs
                Dim th As TaskHost =  exec as TaskHost 
                Console.WriteLine("Executable creation name is: {0}", th.CreationName)
            Next
 
            ' Show use of Contains.
 
            If pgkExecs.Contains(0) Then
                ' Retrieve executable using [item] syntax.
                Dim execItem As Executable =  pgkExecs(0) 
                Dim thItem As TaskHost =  execItem as TaskHost 
                Dim myProps As DtsProperties =  thItem.Properties 
                Dim dtsProp As DtsProperty
                For Each dtsProp In myProps
                    Console.WriteLine("Name {0}, Get? {1} Set? {2}", dtsProp.Name, dtsProp.Get, dtsProp.Set)
                Next
                Console.WriteLine("Contains returned true")
            Else 
                Console.WriteLine("Contains returned false")
            End If
        End Sub
    End Class
End Namespace

Sample Output:

Executable creation name is: Microsoft.SqlServer.Dts.Tasks.BulkInsertTask.BulkInsertTask, Microsoft.SqlServer.BulkInsertTask, Version=9.0.242.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91

Name BatchSize, Get? True Set? True

Name CheckConstraints, Get? True Set? True

Name CodePage, Get? True Set? True

Name CreationName, Get? True Set? False

Name DataFileType, Get? True Set? True

Name DebugMode, Get? True Set? True

Name DelayValidation, Get? True Set? True

Name Description, Get? True Set? True

Name FormatFile, Get? True Set? True

Name WaitForMe, Get? True Set? False

Contains returned true

執行緒安全性

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