I have VS2005 based .Net application that calls and execute SQL Server 2008 SSIS package and results to error.
It works perfectly when I execute package by VS2005 or by selecting package file. Error occurs only with .net application. The SQL account UserName has db_owner rights to the database. The username and password have been defined in web.config
Why this error occurs?
This is error:
-1071636471 SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occurred. Error code: 0x80040E4D. An OLE DB record is available. Source: "Microsoft SQL Server Native Client 10.0" Hresult: 0x80040E4D Description: "Login failed for user 'UserName'.".
-1073573396 Failed to acquire connection "ServerName.DatabaseName.UserName". Connection may not be configured correctly or you may not have the right permissions on this connection.
This is the code:
Imports System.Data.SqlClient
Imports Microsoft.SqlServer.Dts.Runtime
Dim pkgLocation As String
Dim pkg As New Package
Dim app As New Application
Dim pkgResults As DTSExecResult
pkgLocation = Package
Try
If Storage = "Server" Then
If Trusted_Connection Then
pkg = app.LoadFromSqlServer(pkgLocation, DTS_Server, Nothing, Nothing, Nothing)
Else
pkg = app.LoadFromSqlServer(pkgLocation, DTS_Server, DTS_UserId, DTS_Password, Nothing)
End If
Else
pkg = app.LoadPackage(pkgLocation, Nothing)
End If
Catch ex As Exception
lblMsg.Text = "<b>Package load did not succeed, error:</b> " & ex.Message
pkg = Nothing
app = Nothing
Exit Sub
End Try
Try
pkgResults = pkg.Execute()
Catch ex As Exception
lblMsg.Text = "<b>Package execution did not succeed, error:</b> " & ex.Message
End Try
Kenny_I