Check Connection Exist

Lets say I have created an excel connection to an excel file.
During/Before runtime, I have deleted the file.

Is there any way for me to detect if the connection exists or not, and if the connection does not exist, skip a particular data flow process


Answer this question

Check Connection Exist

  • akramm

    Hi there,

    You have a couple of options:
    1. Use a script task to call out to System.IO.File.Exists to confirm the file exists. This will mean you'll have to get the file name from the connection string or use a variable that the connection manager's connection string uses itself.
    2. Use a script task to call AcquireConnection on the connection to see if that succeeds.

    Either way, put the result of the check into a variable and use that variable as a condition on the precedence constraint that goes from the script task to the data flow task.

    Regards,
    ash

  • Check Connection Exist