I have some code (see below) in my SSIS package.
Can anyone show me how to create a variable in the code that has the Vaue "HEADER" and then to only do the file.move stuff if the filename contains the string "HEADER".
I know what i want to do but lack programming skills to write the syntax.
If someone could just put in the one or two lines of code required it would really help me to learn
Can anyone show me how to create a variable in the code that has the Vaue "HEADER" and then to only do the file.move stuff if the filename contains the string "HEADER".
I know what i want to do but lack programming skills to write the syntax.
If someone could just put in the one or two lines of code required it would really help me to learn
VB.NET:
Imports System.IO
Imports System
Imports System.Data
Imports System.Math
Imports Microsoft.SqlServer.Dts.Runtime
Public Class ScriptMain
' The execution engine calls this method when the task executes.
' To access the object model, use the Dts object. Connections, variables, events,
' and logging features are available as static members of the Dts class.
' Before returning from this method, set the value of Dts.TaskResult to indicate success or failure.
'
' To open Code and Text Editor Help, press F1.
' To open Object Browser, press Ctrl+Alt+J.
Public Sub Main()
Try
File.Move(Dts.Variables("Source").Value.ToString, Dts.Variables("Destination").Value.ToString)
Dts.Events.FireInformation(0, "", "File Moved Succesfully", "", 0, True)
Catch ex As Exception
Dts.Events.FireError(1, "", "Source file or destinations does not exist", "", 0)
End Try
Dts.TaskResult = Dts.Results.Success
End Sub
End Class