I am want to take a CSV output (which is UTF-16) and converting it using a script task. The reason is that I need to send the file to 3 different customers/suppliers that have different encoding.
I have the following .NET code but it keep throwing amd error.
Error: Failed to lock variable "C:\EXPORT.csv" for read/write access with error 0xC0010001 "The variable cannot be found. This occurs when an attempt is made to retrieve a variable from the Variables collection on a container during execution of the package, and the variable is not there. The variable name may have changed or the variable is not being created.".
asked Oct 22, 2009 at 07:47 AM in Default
You code looks fine, but I have a theory. When you wanted to add the variable for read/write access, how did you add it?
If you directly add the variable to the list (on the Script page of the Task Editor), it should work fine (but see additional note below). If you added the variable as an expression for the ReadWriteVariables property, then the value of the variable is included in the list instead of the variable itself.
Additional Note: I believe you also need to change your code from
I haven't used VB.NET in awhile, but I know you have to do that with C#. Otherwise, you are trying to convert the Variable object itself.
answered Oct 22, 2009 at 03:07 PM
Tom Staab ♦
Sort this... I didnt defind the input variables correctly via the Task.
answered Oct 22, 2009 at 03:02 PM