简体   繁体   中英

ssis check if file exists

I wanna check using SSIS if there is a file in a specific folder. I created a Data Flow using an Script Task and Send Mail Task. But it always set like there is no file.

Script Task Code:

string FilePath = Dts.Variables["User::vFolderPath"].Value.ToString() +
   Dts.Variables["User::vFileName"].Value.ToString();

if (File.Exists(FilePath))
{
    Dts.Variables["User::vFileExistsFLG"].Value = 1;
}

MessageBox.Show(FilePath);
MessageBox.Show(Dts.Variables["User::vFileExistsFLG"].Value.ToString());
Dts.TaskResult = (int)ScriptResults.Success;

您很可能需要在两者之间手动填充一个“ \\”,如下所示-

    String FilePath=Dts.Variables["User::vFolderPath"].Value.ToString()+ "\\"+ Dts.Variables["User::vFileName"].Value.ToString();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM