Compartir a través de


ScriptObjectModel Clase

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.

Espacio de nombres:  Microsoft.SqlServer.Dts.Tasks.ScriptTask
Ensamblado:  Microsoft.SqlServer.ScriptTask (en Microsoft.SqlServer.ScriptTask.dll)

Sintaxis

'Declaración
Public Class ScriptObjectModel
'Uso
Dim instance As ScriptObjectModel
public class ScriptObjectModel
public ref class ScriptObjectModel
type ScriptObjectModel =  class end
public class ScriptObjectModel

Notas

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.

Ejemplos

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 Consultar Active Directory con la tarea Script.

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

Jerarquía de herencia

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

Seguridad para subprocesos

Todos los miembros públicos static (Shared en Visual Basic) de este tipo son seguros para subprocesos. No se garantiza que los miembros de instancia sean seguros para subprocesos.