Quantcast
Channel: SQL Server Integration Services forum
Viewing all articles
Browse latest Browse all 24688

SCript not working

$
0
0

Hi,

The following script im trying to use for checking the file for its date,

the script has to succeed if its current date, else should fail. 

but the following one not at all working please help.

Public Sub Main()
        Dim Fileinfo As FileInfo
        Fileinfo = New FileInfo(Dts.Variables("User::UserFilePath").Value.ToString())
       
        If Fileinfo.Exists = False Then
            Dts.TaskResult = ScriptResults.Failure
            Return
        End If

        Dim current As Date = DateTime.Now
        Dim fileCreateDate As Date = Fileinfo.CreationTime      

        If current.ToShortDateString <> fileCreateDate.ToShortDateString Then
            Dts.TaskResult = ScriptResults.Failure
        Else
            Dts.TaskResult = ScriptResults.Success
        End If
    End Sub

please let me know where its going wrong !

Thanks !


--------------------------- Radhai Krish | Golden Age is no more far | --------------------------



Viewing all articles
Browse latest Browse all 24688

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>