February 9, 2010 at 12:01 pm
Hi,
I have 2 foreach loop containers within my control flow:
The first foreach loop container loops through a directory and loads files into a table
The second foreach loop container loops through the same directory and moves the files to an archive directory.
When executing the package I receive the following error message:
[File System Task] Error: An error occurred with the following error message: "The process cannot access the file because it is being used by another process".
Any suggestions would be greatly appreciated.
Regards,
Chris
February 9, 2010 at 12:12 pm
Why not use a single Foreach loop to do the entire load/archive process?
The absence of evidence is not evidence of absence.
Martin Rees
You can lead a horse to water, but a pencil must be lead.
Stan Laurel
February 9, 2010 at 12:24 pm
Hi Phil,
I've already tried this and receive the same error
Chris
February 9, 2010 at 1:31 pm
Full details of package as follows:
Loop 1 (looks for Excel file)
loop2 (looks for Excel sheet using ado.net schema rowset)
DFT
End loop 1
End loop 2
|
|
\/
Loop 3
Move file
End Loop3
Could the ado.net schema rowset, be causing issues?
Chris
February 9, 2010 at 3:36 pm
It might be possible that the file download on your source directory is not complete and at the same instance you are trying to move the file. 2 Processes are accessing the same resource.
Create an onfailure event and loop through the rest of the files in the folder or write a script task to Open each file (catch an exception if the file cannot be open) before moving.
April 4, 2012 at 5:36 pm
Since this took me MANY HOURS to solve, I'm posting my solution for others. And it was sooo simple...
Place a copy of your Excel File in another folder and name it "template.xlsx". Have your Schema connection point to this copy. The actual Excel file will no longer be kept locked by the ForEach Worksheet Schema loop!
February 5, 2013 at 2:38 pm
Thank you sooo much. After many days - this is the only solution that worked.:-)
April 24, 2013 at 12:04 pm
Rather than maintain two copies of the same file, Import then move the file all in one loop.
----------------------------------------------------
January 28, 2014 at 11:05 pm
Well, i saw the same issue & there is a property on Excel connection manger "RetainSameConnection". If you set this to "False" , Viola, the error disappears!
January 28, 2014 at 11:06 pm
Well, i saw the same issue & there is a property on Excel connection manger "RetainSameConnection". If you set this to "False" , Viola, the error disappears!
Viewing 10 posts - 1 through 9 (of 9 total)
You must be logged in to reply to this topic. Login to reply