How to validate parameters

How to validate parameters

  • To validate parameters, specify ValidateProperties attribute on the parameters class. Specify method name as attribute parameter. The specified method will be called when the user presses OK in the dialog.


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<ValidateProperties("Validate"})> _
Public Class ScriptMain
 
...
 
Public Function Validate(ByRef errMessage As String) As Boolean
    Dim result As Boolean
 
    result = False
 
    If String.IsNullOrEmpty(Me.FromSender) Then
        errMessage = "Please specify FromSender."
    ElseIf String.IsNullOrEmpty(Me.ToRecipient) Then
        errMessage = "Please specify ToRecipient."
    ElseIf String.IsNullOrEmpty(Me.Subject) Then
        errMessage = "Please specify Subject."
    ElseIf String.IsNullOrEmpty(Me.Message) Then
        errMessage = "Please specify Message."
    Else
        result = True
    End If
 
    Validate = result
End Function

You may also check the sample script Send Mail Task


    Book a Presales Call


    Are you new to COZYROC and evaluating our solutions? 
    Book a Presales Call with us now and get 5% off SSIS+.