December 4, 2007 at 12:31 am
Hi, All:
I use the foreach loop to import all of the excel files in a folder into a database
After I import the files I need to move them into another folder,but I'm in trouble now.
I've got a For Each loop which loops thru all *.Excel files in C:\Documents and Settings\larisaxu\Desktop\BB
Inside For Each loop
I've got a DataFlow Task which has a Excel Source the Excel Souce's connection string is "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="+ @[User::ExcelFile] +";Extended Properties=\"Excel 8.0;HDR=YES\";"
and i've got a FileSystemTask with these settings
IsDestinationpathvariable = false
destinationvariable = BBB
'BBB'is the connection manager i've defined before
Operation = Move file
Issourcepathvariable = true
sourcevariable = User::ExcelFile
the constraint conditioner is from the dataflow task to the file system task
I get this error message:
Error: 0xC002F304 at File System Task, File System Task: An error occurred with the following error message: "The process cannot access the file because it is being used by another process.".
I've tried to move the file system task out of the foreach loop task,and change the constraint conditioner to complete ,but it didn't work,
and i've also tried to add a sequence loop task into the foreach loop task ,then move the dataflow task and file system task into the sequenceloop,it also show the error,finally,i set up a new package ,and put the file systme task into it,it worked.
I dont think it's the best method for this task,i wonder if there is someone know why the Error happened .please .
December 4, 2007 at 7:32 am
Hi Xu,
A process must still have the xls file locked.
Use this tool to find out which process is culprit.
http://www.microsoft.com/technet/sysinternals/utilities/ProcessExplorer.mspx
Norman
DTS Package Search
December 4, 2007 at 7:28 pm
I solve this problem myself.
I've set one property of the Excel connection Manager 'Retainsameconnection' to be true ,but actually,it should be false.
Although after this change there would be an error of the Excel Source ,but it won't affect the result.
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply