Dim varMyCount As Variable = Dts.Variables("mycount") '
Dim varPackageName As Variable = Dts.Variables("PackageName")
Dim varStartTime As Variable = Dts.Variables("StartTime")
Dim varInstanceID As Variable = Dts.Variables("ExecutionInstanceGUID")
Dim PackageDuration As Long
'<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
' Event log needs
'>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Dim sSource As String
Dim sLog As String
Dim sEventMessage As String
Dim sMachine As String
'<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
PackageDuration = DateDiff("s", varStartTime.Value, Now())
sSource = "RowCountReporting from SSIS"
' We need the message posted to the Application event log.
sLog = "Application"
sEventMessage = "Rows Processed: " & Chr(10) _
& " case Rows:" + varMyCount.Value().ToString + Chr(10) _
& "=============================================" & Chr(10) _
& "The Package: " + varPackageName.Value().ToString _
& Chr(10) _
& "Started: " & varStartTime.Value().ToString _
& Chr(10) _
& "Current Time:" & System.DateTime.Now _
& Chr(10) _
& "=============================================" _
& Chr(10) _
& "Package Run Duration in seconds: " & PackageDuration _
& Chr(10) _
& "Execution GUID: " & varInstanceID.Value().ToString
sMachine = "."
If Not EventLog.SourceExists(sSource, sMachine) Then
EventLog.CreateEventSource(sSource, sLog, sMachine)
End If
Dim ELog As New EventLog(sLog, sMachine, sSource)
ELog.WriteEntry(sEventMessage, EventLogEntryType.Information, 777, 2)
'###############################
Dts.TaskResult = Dts.Results.Success