cannot open datafile

  • Hi,

    i'm creating a ssis package to access a flat file.

    i created a batch script to obtain the filename of the newest file in a folder.

    this work fine, but when i want to give that filename to the connection manager by expression (i addes the UNC path with the variable who contains the filename)

    at runtime i have the error : cannot open datafile...

    who can help me?

  • Do you know how to use Script Tasks? I use them to check the values of my variables after the variables have been set.

    Here are instructions in case you don't know how to use it.

    Add Script Task right after the step that loads the variable value. (This is important as adding it before the variable is loaded will not give you the answer you need).

    Choose Visual Basic as the script language in Script tab. (If you don't do this first, it will default to C# and you won't be able to change it short of deleting and recreating the task). C# is fine, BTW, if you know how to program it. This example uses a Visual Basic command.

    In ReadOnlyVariables, put the variable names you want to check.

    Click Edit Script.

    Under Public Sub Main(), put the following code (do not put a single quote before it!):

    MsgBox("This is the value of my variable named XYZ " + Dts.Variables("XYZ").Value.ToString)

    XYZ, is the name of the variable you are reading. You can output multiple variables to a single message box command, but I prefer to do them one at a time so I can see them all.

    When you run the package and it reaches this step, a little popup box will appear with your sentence and the value of the variable. If the sentence ends at "named XYZ" and nothing is after it, or if the popup message is blank, you've somehow got a NULL in your variable.

    The package will stop until you click OK on this message box. Once you click OK, then it will continue on.

    Usually you'll see an error in the path name at this point, or indications that the variable is not being loaded correctly. This is an essential troubleshooting tool for variables (though there may be others) that will help you nail down the problem.

    Brandie Tarvin, MCITP Database AdministratorLiveJournal Blog: http://brandietarvin.livejournal.com/[/url]On LinkedIn!, Google+, and Twitter.Freelance Writer: ShadowrunLatchkeys: Nevermore, Latchkeys: The Bootleg War, and Latchkeys: Roscoes in the Night are now available on Nook and Kindle.

  • This is an essential troubleshooting tool for variables (though there may be others) that will help you nail down the problem.

    There are others - simply setting a pre-execute breakpoint on the task immediately following the one which sets the value of a variable will allow you to see the values of all variables' run-time values at that particular point.

    If you haven't even tried to resolve your issue, please don't expect the hard-working volunteers here to waste their time providing links to answers which you could easily have found yourself.

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply