Error - Cannot open the datafile
Hi there, I have written a program that loads a package (SomePackage.dtsx) from the physical drive and executes that. The package does nothing but imports data from a csv file to the Sql server 2005. But I can see that the package is failing continuously. I meant the package.Execute() method is returning a DTSExecResult.Failure. I investigated the Package.Errors property that contains the error collection and found that there are two DTSError objects into the collection. The first ones description says that Cannot open the datafile "D:\SOME.csv". And the later ones is component "SOURCE FLAT FILE COMPONENT" (1) failed the pre-execute phase and returned error code 0xC020200E. But the most interesting thing is if I execute the package through the Execute package Utility (double clicking onto the SomePackage.dtsx file) ships with Sql server 2005 then it executes fine and works as expected. I have checked the permission of the csv file and it has everyones full access. Can anyone help me on this? I will appreciate all kind of suggestions. Thanks Moim
January 4th, 2007 4:07pm

Hi, "right click" the "flatfile connection manager" click on "Edit". there are several properties here that needs to be configured one of which is the "format".. make sure its "delimited" or something that suits your need. if it didn't solve your problem try other properties in this area. regards, joey
Free Windows Admin Tool Kit Click here and download it now
January 4th, 2007 4:30pm

Hi, "right click" the "flatfile connection manager" click on "Edit". there are several properties here that needs to be configured one of which is the "format".. make sure its "delimited" or something that suits your need. if it didn't solve your problem try other properties in this area. regards, joey
January 4th, 2007 4:30pm

What is different about when you use your tool vs dtexecui? Is this the same machine? Is this the same user running both tools?
Free Windows Admin Tool Kit Click here and download it now
January 4th, 2007 4:39pm

Darren, BasicallyI can see the only difference is when I am running through the code it is failing and when I am running from the windows explorer it is working. Nothing more. It is same machine, same user. Any Idea? Thanks Moim
January 4th, 2007 8:21pm

joeydj, Im afraid, I have created that package programmatically so I dont have a scope to edit that inside the Sql Server BI editor. anyway, I checked out and these properties are set. Any Idea? Thanks Moim
Free Windows Admin Tool Kit Click here and download it now
January 4th, 2007 8:27pm

Is your file on a mapped drive, by chance?
January 4th, 2007 8:45pm

Brammer, No its on a local drive (drive D: ). Any other idea? THanks Moim
Free Windows Admin Tool Kit Click here and download it now
January 4th, 2007 9:40pm

Ok, so same package, same machine, same user, same execution parameters, just a different execution host... does not make much sense. Try adding logging to the package, something simple like log all warnings and errors to a text file. Any other errors? There must be some difference but that error is not very clear as to what.
January 5th, 2007 4:00am

I had same problem and I am using UNC path. The problem occures after changing the logic of package. why we get this error and how to troubleshoot this?thanks,------------------------ Brahma http://vbrchowdary.info
Free Windows Admin Tool Kit Click here and download it now
March 16th, 2010 3:57pm

How can this be the accepted answer?
January 31st, 2011 3:55pm

I had a similar issue and the above accepted answer does not solve it. Without going into too much detail, I've a loop container iterating through and envoking a data flow task to load multiple flat files. I was passing the filename as a variable but ommitted to include the path! I added the path as a variable in the expression and violá! To debug, perhaps try output the path & filename on execution and confirm it's as expected? hope this helps! KP
Free Windows Admin Tool Kit Click here and download it now
June 10th, 2011 7:35am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics