次の方法で共有


UsePassiveMode プロパティ

タスクがパッシブ モードでファイルを送信および受信するかどうかを示す Boolean を取得します。値の設定も可能です。

名前空間:  Microsoft.SqlServer.Dts.Runtime
アセンブリ:  Microsoft.SqlServer.ManagedDTS (Microsoft.SqlServer.ManagedDTS.dll)

構文

'宣言
Public Property UsePassiveMode As Boolean
    Get
    Set
'使用
Dim instance As FtpClientConnection
Dim value As Boolean

value = instance.UsePassiveMode

instance.UsePassiveMode = value
public bool UsePassiveMode { get; set; }
public:
property bool UsePassiveMode {
    bool get ();
    void set (bool value);
}
member UsePassiveMode : bool with get, set
function get UsePassiveMode () : boolean
function set UsePassiveMode (value : boolean)

プロパティ値

型: System. . :: . .Boolean
タスクがパッシブ モードでファイルを送信および受信する場合は true、タスクがアクティブ モードを使用している場合は false です。

説明

このプロパティの既定値は false です。アクティブ モードおよびパッシブ モードの詳細については、「FTP タスク」を参照してください。

使用例

FTP クライアント接続の作成方法として最も一般的なものは、ConnectionManager を使用する方法です。InnerObject には接続が含まれ、ConnectionManager に含まれた特定の接続のすべてのプロパティは、Properties コレクションを通じてアクセスできます。次のコード例では、接続マネージャを使用して FTP 接続を作成し、Properties コレクションを使用してプロパティを設定します。

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

namespace Microsoft.SqlServer.SSIS.Samples
{
    class mySqlServer_Sample
    {
        static void Main(string[] args)
        {
            Package pkg = new Package();
            FtpClientConnection ftp = null;
            Connections conns = pkg.Connections;
            ConnectionManager cm = conns.Add("FTP");

            // Display the default values of the FTP connection properties.
            // Some properties are not shown as they are write-only.
            Console.WriteLine("ChunkSize:      {0}", cm.Properties["ChunkSize"].GetValue(cm));
            Console.WriteLine("Retries:        {0}", cm.Properties["Retries"].GetValue(cm));
            Console.WriteLine("ServerName:     {0}", cm.Properties["ServerName"].GetValue(cm));
            Console.WriteLine("ServerPort:     {0}", cm.Properties["ServerPort"].GetValue(cm));
            Console.WriteLine("ServerUserName: {0}", cm.Properties["ServerUserName"].GetValue(cm));
            Console.WriteLine("Timeout:        {0}", cm.Properties["Timeout"].GetValue(cm));
            Console.WriteLine("UsePassiveMode: {0}",cm.Properties["UsePassiveMode"].GetValue(cm));

            Console.WriteLine();
        }
    }
}
Imports System
Imports System.Collections.Generic
Imports System.Text
Imports Microsoft.SqlServer.Dts.Runtime
Imports Microsoft.SqlServer.Dts.Tasks.FileSystemTask
 
Namespace Microsoft.SqlServer.SSIS.Samples
    Class mySqlServer_Sample
        Shared  Sub Main(ByVal args() As String)
            Dim pkg As Package =  New Package() 
            Dim ftp As FtpClientConnection =  Nothing 
            Dim conns As Connections =  pkg.Connections 
            Dim cm As ConnectionManager =  conns.Add("FTP") 
 
            ' Display the default values of the FTP connection properties.
            ' Some properties are not shown as they are write-only.
            Console.WriteLine("ChunkSize:      {0}", cm.Properties("ChunkSize").GetValue(cm))
            Console.WriteLine("Retries:        {0}", cm.Properties("Retries").GetValue(cm))
            Console.WriteLine("ServerName:     {0}", cm.Properties("ServerName").GetValue(cm))
            Console.WriteLine("ServerPort:     {0}", cm.Properties("ServerPort").GetValue(cm))
            Console.WriteLine("ServerUserName: {0}", cm.Properties("ServerUserName").GetValue(cm))
            Console.WriteLine("Timeout:        {0}", cm.Properties("Timeout").GetValue(cm))
            Console.WriteLine("UsePassiveMode: {0}",cm.Properties("UsePassiveMode").GetValue(cm))
 
            Console.WriteLine()
        End Sub
    End Class
End Namespace

サンプルの出力 :

ChunkSize: 1

Retries: 5

ServerName:

ServerPort: 21

ServerUserName:

Timeout: 60

UsePassiveMode: False