Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

execute dts package from asp.net

Status
Not open for further replies.

ArizonaRedneck

Programmer
Oct 25, 2004
61
0
0
US
hi, I'm trying to execute a package from a sql server on my local box. I have added all references neccessary for it to run. When I run the package from enterprise manager, it works fine. When I run it from my aspx page it throws an error. Something about data pump task or something like that.

Code:
Dim pkg As DTS.Package2
Dim oStep As DTS.Step

Try
	pkg = New DTS.Package2
	pkg.LoadFromSQLServer("localhost", "Uname", "Pword", _
	DTSSQLServerStorageFlags.DTSSQLStgFlag_Default, _
	"", "", "", PackageName, Nothing)

	pkg.AutoCommitTransaction = True

	For Each oStep In pkg.Steps
		oStep.ExecuteInMainThread = True
	Next


	pkg.Execute()

	For Each oStep In pkg.Steps
		If oStep.ExecutionResult = DTSStepExecResult.DTSStepExecResult_Failure Then
			Throw New Exception("Error while processing " & pkg.Name & " on step " & oStep.Name)
		End If
	Next
Catch ex As System.Runtime.InteropServices.COMException
	Throw ex
Catch ex As Exception
	Throw ex
Finally
	pkg.UnInitialize()
	pkg = Nothing
End Try
I put a breakpoint in the code on the line where it executes the package to make sure that it found the correct one and it does. I have tried using both DTS.Package2 and DTS.Package and neither of them work. Any help would be greatly appreciated.

-
"Do your duty in all things. You cannot do more, you should never wish to do less." Robert E. Lee
 
I just tried the code in a vb.net windows app and it works fine. Is it possible to run a dts package from asp.net?

-
"Do your duty in all things. You cannot do more, you should never wish to do less." Robert E. Lee
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top