Condividi tramite


ASExecuteDDLTask.SourceType Proprietà

Definizione

Ottiene o imposta un valore dell'enumerazione DDLSourceType che indica il tipo di origine contenente l'istruzione DDL.

public:
 property Microsoft::DataTransformationServices::Tasks::DTSProcessingTask::DDLSourceType SourceType { Microsoft::DataTransformationServices::Tasks::DTSProcessingTask::DDLSourceType get(); void set(Microsoft::DataTransformationServices::Tasks::DTSProcessingTask::DDLSourceType value); };
public Microsoft.DataTransformationServices.Tasks.DTSProcessingTask.DDLSourceType SourceType { get; set; }
member this.SourceType : Microsoft.DataTransformationServices.Tasks.DTSProcessingTask.DDLSourceType with get, set
Public Property SourceType As DDLSourceType

Valore della proprietà

Valore ricavato dall'enumerazione DDLSourceType.

Esempio

L'esempio di codice seguente crea, configura ed esegue una nuova ASExecuteDDLTask istruzione che carica l'istruzione DDL da eseguire da una connessione file. L'esempio usa la SourceType proprietà .

using Microsoft.SqlServer.Dts.Runtime;  
using Microsoft.DataTransformationServices.Tasks.DTSProcessingTask;  

class Module1  
{  

  public static void Main()  
  {  

    Package pkg = new Package();  

    ConnectionManager asCM;  
    asCM = pkg.Connections.Add("MSOLAP100");  
    asCM.Name = "Analysis Services Connection Manager";  
    asCM.ConnectionString = "Data Source=<servername>;" +  
      "Initial Catalog=Adventure Works DW;Provider=MSOLAP;" +  
      "Integrated Security=SSPI;Impersonation Level=Impersonate;";  

    ConnectionManager cmdCM;  
    cmdCM = pkg.Connections.Add("FILE");  
    cmdCM.Name = "Command Source Connection Manager";  
    cmdCM.ConnectionString = "C:\\ddltest.txt";  

    Executable exe = pkg.Executables.Add("Microsoft.DataTransformationServices.Tasks.DTSProcessingTask.ASExecuteDDLTask, " +  
      "Microsoft.SqlServer.ASTasks, Version=10.0.0.0, " +  
      "Culture=neutral, PublicKeyToken=89845dcd8080cc91");  
    TaskHost thTask = (TaskHost) exe;  
    {  
      thTask.Properties("ConnectionName").SetValue(thTask, "Analysis Services Connection Manager");  
      thTask.Properties("SourceType").SetValue(thTask, DDLSourceType.FileConnection);  
      thTask.Properties("Source").SetValue(thTask, "Command Source Connection Manager");  
    }  

    DTSExecResult valResults = pkg.Validate(pkg.Connections, pkg.Variables, null, null);  

    if (valResults==DTSExecResult.Success)  
    {  
      pkg.Execute();  
    }  

  }  

}  
Imports Microsoft.SqlServer.Dts.Runtime  
Imports Microsoft.DataTransformationServices.Tasks.DTSProcessingTask  

Module Module1  

  Sub Main()  

    Dim pkg As New Package  

    Dim asCM As ConnectionManager  
    asCM = pkg.Connections.Add("MSOLAP100")  
    asCM.Name = "Analysis Services Connection Manager"  
    asCM.ConnectionString = "Data Source=<servername>;" & _  
      "Initial Catalog=Adventure Works DW;Provider=MSOLAP;" & _  
      "Integrated Security=SSPI;Impersonation Level=Impersonate;"  

    Dim cmdCM As ConnectionManager  
    cmdCM = pkg.Connections.Add("FILE")  
    cmdCM.Name = "Command Source Connection Manager"  
    cmdCM.ConnectionString = "C:\ddltest.txt"  

    Dim exe As Executable = pkg.Executables.Add( _  
      "Microsoft.DataTransformationServices.Tasks.DTSProcessingTask.ASExecuteDDLTask, " & _  
      "Microsoft.SqlServer.ASTasks, Version=10.0.0.0, " & _  
      "Culture=neutral, PublicKeyToken=89845dcd8080cc91")  
    Dim thTask As TaskHost = CType(exe, TaskHost)  
    With thTask  
      .Properties("ConnectionName").SetValue(thTask, _  
        "Analysis Services Connection Manager")  
      .Properties("SourceType").SetValue(thTask, DDLSourceType.FileConnection)  
      .Properties("Source").SetValue(thTask, "Command Source Connection Manager")  
    End With  

    Dim valResults As DTSExecResult = pkg.Validate( _  
      pkg.Connections, pkg.Variables, Nothing, Nothing)  

    If valResults = DTSExecResult.Success Then  
      pkg.Execute()  
    End If  

  End Sub  

End Module  

Si applica a