Error running the Package: The variable cannot be found

I'm trying to run a package by asp.net web App and  I'm getting an error. The interesting thing is, It runs very fine on my Dev db instance but errors out on prod db instance. I checked all the settings of the accounts/package properties are the same.

Here is the code I've used:
 Dim pkgLocation As String
        Dim pkg As New Package
        Dim app As New Application
        Dim pkgResults As DTSExecResult
        pkgLocation = _
              Server.MapPath(AppSettings("PackageLocation"))
        pkg = app.LoadPackage(pkgLocation, Nothing)
        pkgResults = pkg.Execute()
        If (pkgResults = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Failure) Then
            pkg.Variables("ErrorDescription").Value.ToString()
        End If


And here is the error message I'm getting :  (By the way there are no variables used by the package)
"Couldn't Run the Package: 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."
netsol07Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

netsol07Author Commented:
I kind od realized that the package is failing, hence looking gor the variable ErrorDescription. How do I find out why the package is failing? As it runs fine on dev instace.
0
nmcdermaidCommented:
Turn on package logging (within the package) then check the package log
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
netsol07Author Commented:
I'll try to do that and get back.
The package runs perfectly fine even on prod db when i run it from sql integration services but errors out while running from the web app. I checked the user accounts to the file folders where the package is located but everything looks fine,
0
Anthony PerkinsCommented:
>>I kind od realized that the package is failing, hence looking gor the variable ErrorDescription.<<
It appears to be in the code you posted:
 If (pkgResults = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Failure) Then
            pkg.Variables("ErrorDescription").Value.ToString()
        End If

Or what am I missing?
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server

From novice to tech pro — start learning today.