ScriptObjectModel.Events Property
Returns the IDTSComponentEvents collection of existing events defined in the package that contains the Script task.
네임스페이스: Microsoft.SqlServer.Dts.Tasks.ScriptTask
어셈블리: Microsoft.SqlServer.ScriptTask (in microsoft.sqlserver.scripttask.dll)
구문
‘선언
Public ReadOnly Property Events As IDTSComponentEvents
public IDTSComponentEvents Events { get; }
public:
property IDTSComponentEvents^ Events {
IDTSComponentEvents^ get ();
}
/** @property */
public IDTSComponentEvents get_Events ()
public function get Events () : IDTSComponentEvents
속성 값
The IDTSComponentEvents collection of existing events defined in the package that contains the Script task.
주의
Use the Events property of the Dts object in Script task code to raise errors, warnings and information messages.
예
The following sample of code for use inside a Script task demonstrates how to raise events from within the Script task. The example uses a native Windows API function to determine whether an Internet connection is available. If no connection is available, it raises an error. If a potentially volatile modem connection is in use, the example raises a warning. Otherwise, it returns an informational message that an Internet connection has been detected.
Private Declare Function InternetGetConnectedState Lib "wininet" _
(ByRef dwFlags As Long, ByVal dwReserved As Long) As Long
Private Enum ConnectedStates
LAN = &H2
Modem = &H1
Proxy = &H4
Offline = &H20
Configured = &H40
RasInstalled = &H10
End Enum
Public Sub Main()
Dim dwFlags As Long
Dim connectedState As Long
connectedState = InternetGetConnectedState(dwFlags, 0)
If connectedState <> 0 Then
If (dwFlags And ConnectedStates.Modem) = ConnectedStates.Modem Then
Dts.Events.FireWarning(0, "Script Task Example", _
"Volatile Internet connection detected.", String.Empty, 0)
Else
Dts.Events.FireInformation(0, "Script Task Example", _
"Internet connection detected.", String.Empty, 0, False)
End If
Else
' If not connected to the Internet, raise an error.
Dts.Events.FireError(0, "Script Task Example", _
"Internet connection not available.", String.Empty, 0)
End If
Dts.TaskResult = Dts.Results.Success
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 Class
ScriptObjectModel Members
Microsoft.SqlServer.Dts.Tasks.ScriptTask Namespace