次の方法で共有


ExecuteSQLTask.ParameterBindings プロパティ

IDTSParameterBindings を実装するオブジェクトを返します。

名前空間:  Microsoft.SqlServer.Dts.Tasks.ExecuteSQLTask
アセンブリ:  Microsoft.SqlServer.SQLTask (Microsoft.SqlServer.SQLTask.dll)

構文

'宣言
Public ReadOnly Property ParameterBindings As IDTSParameterBindings 
    Get
'使用
Dim instance As ExecuteSQLTask 
Dim value As IDTSParameterBindings 

value = instance.ParameterBindings
public IDTSParameterBindings ParameterBindings { get; }
public:
virtual property IDTSParameterBindings^ ParameterBindings {
    IDTSParameterBindings^ get () sealed;
}
abstract ParameterBindings : IDTSParameterBindings 
override ParameterBindings : IDTSParameterBindings
final function get ParameterBindings () : IDTSParameterBindings

プロパティ値

型: Microsoft.SqlServer.Dts.Tasks.ExecuteSQLTask.IDTSParameterBindings
IDTSParameterBindings インターフェイスを実装するオブジェクトです。

実装

IDTSExecuteSQL.ParameterBindings

説明

これらの IDTSParameterBindings は、SQL ステートメントのパラメーターです。 パラメーターは取得、追加、および削除でき、コレクションは消去できます。

使用例

次の例では、まず ExecuteSQLTask を作成し、次に TaskHost を使用して、ParameterBindings を含むプロパティの既定の設定を出力します。 その後、一部のプロパティの値を設定して、プロパティ値の設定方法を示します。

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

namespace Microsoft.SqlServer.SSIS.Samples
{
    class Program
    {
        static void Main(string[] args)
        {
            Package pkg = new Package();
            Executable exec1 = pkg.Executables.Add("STOCK:SQLTask");
            TaskHost th = exec1 as TaskHost;

            // List the default values of the Execute SQL task
            // by using the Properties collection of the TaskHost.
            Console.WriteLine("BypassPrepare          {0}", th.Properties["BypassPrepare"].GetValue(th));
            Console.WriteLine("CodePage               {0}", th.Properties["CodePage"].GetValue(th));
            Console.WriteLine("Connection             {0}", th.Properties["Connection"].GetValue(th));
            Console.WriteLine("ExecutionValue         {0}", th.Properties["ExecutionValue"].GetValue(th));
            Console.WriteLine("IsStoredProcedure      {0}", th.Properties["IsStoredProcedure"].GetValue(th));
            Console.WriteLine("ParameterBindings      {0}", th.Properties["ParameterBindings"].GetValue(th));
            Console.WriteLine("ResultSetBindings      {0}", th.Properties["ResultSetBindings"].GetValue(th));
            Console.WriteLine("ResultSetType          {0}", th.Properties["ResultSetType"].GetValue(th));
            Console.WriteLine("SqlStatementSource     {0}", th.Properties["SqlStatementSource"].GetValue(th));
            Console.WriteLine("SqlStatementSourceType {0}", th.Properties["SqlStatementSourceType"].GetValue(th));
            Console.WriteLine("TimeOut                {0}", th.Properties["TimeOut"].GetValue(th));
            
            Console.WriteLine("--------------------------");
            // Show how to set a property by using the TaskHost properties.
            Variable myVar = pkg.Variables.Add("myVar", false, "User", 100);
            th.Properties["SqlStatementSourceType"].SetValue(th, SqlStatementSourceType.Variable);
            th.Properties["SqlStatementSource"].SetValue(th, "myVar");
            th.Properties["ResultSetType"].SetValue(th, ResultSetType.ResultSetType_XML);
            
            Console.WriteLine("New value of Source and SourceType:  {0}, {1}", th.Properties["SqlStatementSource"].GetValue(th), th.Properties["SqlStatementSourceType"].GetValue(th));
            Console.WriteLine("New value of ResultSetType:  {0}", th.Properties["ResultSetType"].GetValue(th), th.Properties["SqlStatementSourceType"].GetValue(th));

            Console.WriteLine();
        }
    }
}
Imports System
Imports System.Collections.Generic
Imports System.Text
Imports Microsoft.SqlServer.Dts.Runtime
Imports Microsoft.SqlServer.Dts.Tasks.ExecuteSQLTask
 
Namespace Microsoft.SqlServer.SSIS.Samples
    Class Program
        Shared  Sub Main(ByVal args() As String)
            Dim pkg As Package =  New Package() 
            Dim exec1 As Executable =  pkg.Executables.Add("STOCK:SQLTask") 
            Dim th As TaskHost =  exec1 as TaskHost 
 
            ' List the default values of the Execute SQL task
            ' by using the Properties collection of the TaskHost.
            Console.WriteLine("BypassPrepare          {0}", th.Properties("BypassPrepare").GetValue(th))
            Console.WriteLine("CodePage               {0}", th.Properties("CodePage").GetValue(th))
            Console.WriteLine("Connection             {0}", th.Properties("Connection").GetValue(th))
            Console.WriteLine("ExecutionValue         {0}", th.Properties("ExecutionValue").GetValue(th))
            Console.WriteLine("IsStoredProcedure      {0}", th.Properties("IsStoredProcedure").GetValue(th))
            Console.WriteLine("ParameterBindings      {0}", th.Properties("ParameterBindings").GetValue(th))
            Console.WriteLine("ResultSetBindings      {0}", th.Properties("ResultSetBindings").GetValue(th))
            Console.WriteLine("ResultSetType          {0}", th.Properties("ResultSetType").GetValue(th))
            Console.WriteLine("SqlStatementSource     {0}", th.Properties("SqlStatementSource").GetValue(th))
            Console.WriteLine("SqlStatementSourceType {0}", th.Properties("SqlStatementSourceType").GetValue(th))
            Console.WriteLine("TimeOut                {0}", th.Properties("TimeOut").GetValue(th))
 
            Console.WriteLine("--------------------------")
            ' Show how to set a property by using the TaskHost properties.
            Dim myVar As Variable =  pkg.Variables.Add("myVar",False,"User",100) 
            th.Properties("SqlStatementSourceType").SetValue(th, SqlStatementSourceType.Variable)
            th.Properties("SqlStatementSource").SetValue(th, "myVar")
            th.Properties("ResultSetType").SetValue(th, ResultSetType.ResultSetType_XML)
 
            Console.WriteLine("New value of Source and SourceType:  {0}, {1}", th.Properties("SqlStatementSource").GetValue(th), th.Properties("SqlStatementSourceType").GetValue(th))
            Console.WriteLine("New value of ResultSetType:  {0}", th.Properties("ResultSetType").GetValue(th), th.Properties("SqlStatementSourceType").GetValue(th))
 
            Console.WriteLine()
        End Sub
    End Class
End Namespace

サンプルの出力 :

BypassPrepare False

CodePage 1252

Connection

ExecutionValue

IsStoredProcedure False

ParameterBindings Microsoft.SqlServer.Dts.Tasks.ExecuteSQLTask.ParameterBindings

ResultSetBindings Microsoft.SqlServer.Dts.Tasks.ExecuteSQLTask.ResultBindings

ResultSetType 1

SqlStatementSource

SqlStatementSourceType 1

TimeOut 0

--------------------------

New value of Source and SourceType: myVar, 3

New value of ResultSetType: 4

関連項目

参照

ExecuteSQLTask クラス

Microsoft.SqlServer.Dts.Tasks.ExecuteSQLTask 名前空間