Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ssis/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 无法读取平面文件源_C#_Ssis_C# 3.0 - Fatal编程技术网

C# 无法读取平面文件源

C# 无法读取平面文件源,c#,ssis,c#-3.0,C#,Ssis,C# 3.0,我想从用户那里获得文件名,然后根据该名称我将获得另一个输入。这是一个多输入多输出的问题。 因此,我将问题标准化如下 1.我在控制流中使用脚本Tast,并要求使用C#中的表单输入文件名。我在浏览文件时得到文件名 2.然后解压文件并根据文件名检查文件名,我设置了3个变量,它们是globel 3.根据变量,我做了3个数据流任务。对于上述指定的问题,它工作得很好 4.它适用于不同的数据流任务 但是,当我使用平面文件源名称作为动态(使用表达式)时,我有另一个问题,它给了我关于无法打开文件的错误 错误“[平

我想从用户那里获得文件名,然后根据该名称我将获得另一个输入。这是一个多输入多输出的问题。 因此,我将问题标准化如下

1.我在控制流中使用脚本Tast,并要求使用C#中的表单输入文件名。我在浏览文件时得到文件名

2.然后解压文件并根据文件名检查文件名,我设置了3个变量,它们是globel

3.根据变量,我做了3个数据流任务。对于上述指定的问题,它工作得很好

4.它适用于不同的数据流任务

但是,当我使用平面文件源名称作为动态(使用表达式)时,我有另一个问题,它给了我关于无法打开文件的错误

错误“[平面文件源[1]]错误:无法打开数据文件“C:\Documents and Settings\XQN4P\Desktop\Inputs\Intraday\OPTION\u DAILY\u Intraday\u ASIA20140212.csv”

注意:此文件由用户解压输入的文件生成

还有一个警告“[Flat File Source[1]]警告:该进程无法访问该文件,因为它正被另一个进程使用。 “

这是我用来解压它的代码

}
private void unzipInFile(string inputFilePath, string destDirectory,string destFileName)
{
    FileStream fsIn  =new FileStream (inputFilePath, FileMode.Open, FileAccess.Read, FileShare.Read);
    FileStream fsOut =new FileStream(destDirectory +"\\"+destFileName, FileMode.Create, FileAccess.Write, FileShare.ReadWrite);
     int  buffersize = 4096;
    int count = 0;
    var   buffer= new byte [buffersize]; 
    //using (Stream compressed = File.OpenRead(inputFilePath))
    //using (ZlibStream zlib = new ZlibStream(compressed, CompressionMode.Decompress))
    using(GZipStream gZip  = new GZipStream(fsIn, Ionic.Zlib.CompressionMode.Decompress, Ionic.Zlib.CompressionLevel.BestCompression, true ))

    {
        byte[] buf = new byte[short.MaxValue];
        int bufl;
        while (0 != (bufl = gZip.Read(buf, 0, buf.Length)))
        {
            if (count != 0) 
                fsOut.Write(buffer, 0, count);
            if (count != buffersize)
                 return ;
        }
    }
    fsOut.Close();


}
另一个地址变量

Dts.Variables["FileAddress"].Value = filePath + ".csv";
SSIS结构: “ScriptTask”将输出发送到3个数据流任务。

问题已解决。 问题在于解压缩文件的格式设置。 无法获取行分隔符。 有时这个文件还在使用中。
因此,我对此进行了研究,没关系,你能在这里发布一些代码吗?嗨,我想问题在于解压文件,因为我检查了文件是否为空。当我跳过解压并将提取的文件放在那里时,它正在工作。但我对解压功能感到惊讶,为什么它不起作用,而是在另一个功能中起作用。。