Export (0) Print
Expand All

DTS Example: Basic Custom Task in Visual Basic

SQL Server 2000

DTS Example: Basic Custom Task in Visual Basic

The following code example implements a basic Data Transformation Services (DTS) custom task in Microsoft® Visual Basic®.

When executed, the application displays a fixed message in a message box. The Execute method displays the message box. The Name property returns the value to which it was set. The Description property and Properties collection are placeholders.

Implementing a Basic DTS Custom Task

Use the following Visual Basic code to implement a basic DTS custom task:

Implements DTS.CustomTask

Private mstrTaskName    As String

Private Sub CustomTask_Execute(ByVal pPackage As Object, ByVal pPackageEvents As Object, _
            ByVal pPackageLog As Object, pTaskResult As DTS.DTSTaskExecResult)
    MsgBox "Minimum custom task!", vbExclamation
    pTaskResult = DTSTaskExecResult_Success
End Sub

Private Property Get CustomTask_Properties() As DTS.Properties
'CustomTask_Properties returns Nothing.
End Property

Private Property Get CustomTask_Description() As String
'Description returns empty string.
End Property

Private Property Let CustomTask_Description(ByVal RHS As String)
'Description set value is discarded.
End Property

Private Property Get CustomTask_Name() As String
'Implements Task.Name.
    CustomTask_Name = mstrTaskName
End Property

Private Property Let CustomTask_Name(ByVal strNewName As String)
'Implements Task.Name.
    mstrTaskName = strNewName
End Property
Show:
© 2015 Microsoft