0
我有一个来自SSIS脚本任务中本地文件夹的文件列表,我需要将它记录到SQL表中。有没有什么方法可以直接从脚本任务中完成,或者可以将结果放入对象变量中,然后将其填充到SQL表中。我没有选择For Each Loop容器,因为我觉得我可以从脚本任务记录更多细节。将脚本任务中的文件列表记录到SQL表
代码:
List<String> FileList = new List<string>();
List<String> FileLoc = new List<string>();
foreach (string dirpath in Directory.EnumerateDirectories("C:\\Program Files\"))
foreach (string path in Directory.EnumerateFiles(dirpath))
{
FileList.Add(Path.GetFileName(path));
FileLoc.Add(Path.GetDirectoryName(path));
}
我想每个LOF的文件列表并FileLoc为表中的各列。 PS:我是C#的新手。
我很想将此作为一个重复的问题[this](http://stackoverflow.com/questions/11751901/ssis-script-task-get-file-names-and-store-to-an-ssis-object-variable)。 – BCdotWEB 2015-02-11 10:07:24
是!这对我很好!谢谢@BCdotWEB! – Prakazz 2015-02-11 13:20:33