• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 649
  • Last Modified:

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."
0
netsol07
Asked:
netsol07
  • 2
2 Solutions
 
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
 
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

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now