SSIS error while moving the file

  • The package : Import_pkg1: failed with the errorcode: 1 Exception has been thrown by the target of an invocation.

    I am using script component to move the file .

    try

    {

    foreach (string currFile in aFiles)

    {

    FileInfo currFileInfo = new FileInfo(currFile);

    currFileInfo.MoveTo(directoryDestPath + "\\" + Path.GetFileNameWithoutExtension(sFilename) + "_" + DateTime.Now.ToShortTimeString().ToString().Replace(":", "").Replace("PM", "") + ".csv");

    }

    Dts.TaskResult = (int)ScriptResults.Success;

    }

    catch (Exception ex)

    {

    MailMessage myHtmlFormattedMail = new MailMessage("xxx1@domain.com", "xxx1@domain.com", "file archive Error", ex.Message.ToString() + ex.InnerException.ToString());

    SmtpClient mySmtpClient = new SmtpClient("mail.domain.com");

    mySmtpClient.Send(myHtmlFormattedMail);

    Dts.TaskResult = (int)ScriptResults.Failure;

    }

    The above code still does not give me a decriptiove error. How can I capture the exact error to see what is happening while moving the file?

Viewing 0 posts

You must be logged in to reply to this topic. Login to reply