ScriptObjectModel Class
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.
네임스페이스: Microsoft.SqlServer.Dts.Tasks.ScriptTask
어셈블리: Microsoft.SqlServer.ScriptTask (in microsoft.sqlserver.scripttask.dll)
구문
‘선언
Public Class ScriptObjectModel
public class ScriptObjectModel
public ref class ScriptObjectModel
public class ScriptObjectModel
public class ScriptObjectModel
주의
Within the Microsoft Visual Basic for Applications (VSA) 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.
Inheritance Hierarchy
System.Object
Microsoft.SqlServer.Dts.Tasks.ScriptTask.ScriptObjectModel
예
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 Querying the Active Directory with the Script Task.
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 = Dts.Results.Success
Catch ex As Exception
Dts.Events.FireError(0, _
"Script Task Example", _
ex.Message & ControlChars.CrLf & ex.StackTrace, _
String.Empty, 0)
Dts.TaskResult = Dts.Results.Failure
End Try
End Sub
스레드 보안
Any public static (Shared in Microsoft Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
플랫폼
개발 플랫폼
지원되는 플랫폼 목록은 SQL Server 2005 설치를 위한 하드웨어 및 소프트웨어 요구 사항을 참조하십시오.
대상 플랫폼
지원되는 플랫폼 목록은 SQL Server 2005 설치를 위한 하드웨어 및 소프트웨어 요구 사항을 참조하십시오.
참고 항목
참조
ScriptObjectModel Members
Microsoft.SqlServer.Dts.Tasks.ScriptTask Namespace