Share via


ScriptObjectModel 클래스

Gives the developer of the Script task programmatic access to objects defined in the package through the global Dts object. The Dts object is an instance of the ScriptObjectModel class.

상속 계층

System. . :: . .Object
  Microsoft.SqlServer.Dts.Tasks.ScriptTask..::..ScriptObjectModel

네임스페이스:  Microsoft.SqlServer.Dts.Tasks.ScriptTask
어셈블리:  Microsoft.SqlServer.ScriptTask(Microsoft.SqlServer.ScriptTask.dll)

구문

‘선언
Public Class ScriptObjectModel
‘사용 방법
Dim instance As ScriptObjectModel
public class ScriptObjectModel
public ref class ScriptObjectModel
type ScriptObjectModel =  class end
public class ScriptObjectModel

ScriptObjectModel 유형에서 다음 멤버를 표시합니다.

속성

  이름 설명
공용 속성 Connections Returns the Connections collection of existing connections defined in the package that contains the Script task.
공용 속성 Events Returns the IDTSComponentEvents collection of existing events defined in the package that contains the Script task.
공용 속성 ExecutionValue Gets or sets a user-defined object that provides additional information about the results of task execution.
공용 속성 TaskResult Returns the DTSExecResult of the Script task.
공용 속성 Transaction Returns the transaction associated with the container of the Script task.
공용 속성 VariableDispenser Returns the VariableDispenser that can be used within the Script task to work with existing variables.
공용 속성 Variables Returns the Variables collection of existing variables defined in the package that contains the Script task.

맨 위로 이동

메서드

  이름 설명
공용 메서드 Equals (Object에서 상속됨)
보호된 메서드 Finalize (Object에서 상속됨)
공용 메서드 GetHashCode (Object에서 상속됨)
공용 메서드 GetType (Object에서 상속됨)
공용 메서드 Log Logs an entry to all enabled log providers.
보호된 메서드 MemberwiseClone (Object에서 상속됨)
공용 메서드 ToString (Object에서 상속됨)

맨 위로 이동

주의

Within the Microsoft Visual Studio 2008 Tools for Applications (VSTA) scripting environment, the Script task provides the global Dts object, which gives the developer programmatic access to objects defined elsewhere in the package, such as connections, variables, and events, through the properties and methods of the ScriptObjectModel class. The Dts object is an instance of the ScriptObjectModel class.

The following sample of code for use inside a Script task demonstrates the use of the Variables, Events, and TaskResult properties. For more information, see 스크립트 태스크를 사용하여 Active Directory 쿼리.

Public Sub Main()

    Dim directory As DirectoryServices.DirectorySearcher
    Dim result As DirectoryServices.SearchResult
    Dim email As String

    email = Dts.Variables("email").Value.ToString

    Try
        directory = New _
            DirectoryServices.DirectorySearcher("(mail=" & email & ")")
        result = directory.FindOne
        Dts.Variables("name").Value = _
            result.Properties("displayname").ToString
        Dts.Variables("title").Value = _
            result.Properties("title").ToString
        Dts.TaskResult = ScriptResults.Success
    Catch ex As Exception
        Dts.Events.FireError(0, _
            "Script Task Example", _
            ex.Message & ControlChars.CrLf & ex.StackTrace, _
            String.Empty, 0)
        Dts.TaskResult = ScriptResults.Failure
    End Try

End Sub

스레드 보안

이 유형의 모든 공용 static(Visual Basic에서는 Shared) 멤버는 스레드로부터 안전합니다. 인스턴스 멤버는 스레드로부터의 안전성이 보장되지 않습니다.