How do you activate SQL Server DTS packages from ASP
Activate SQL Server DTS packages from ASP
All you have to do is to
Create an instance of DTS package using Server.CreateObject("DTS.package")
And load it using LoadFromSQLServer
Here’s an example of the code to do it. You need to make sure that you have created a DTS package first.
Dim oPkg, oStep, sMessage, bStatus
Set oPkg = Server.CreateObject("DTS.Package")
oPkg.LoadFromSQLServer "MyServer","MyUser","MyPassword",DTSSQLStgFlag_Default,"PackagePassword","","","MyPackage"
oPkg.Execute()
bStatus = True
For Each oStep In oPkg.Steps
sMessage = sMessage & "
Step [" & oStep.Name & "] "
If oStep.ExecutionResult = DTSStepExecResult_Failure Then
sMessage = sMessage & " failed
"
bStatus = False
Else
sMessage = sMessage & " succeeded
"
End If
sMessage = sMessage & "Task """ & oPkg.Tasks(oStep.TaskName).Description & """
"Next
If bStatus Then
sMessage = sMessage & "
Package [" & oPkg.Name & "] succeeded
"Else
sMessage = sMessage & "
Package [" & oPkg.Name & "] failed
"End If
Response.Write sMessage
Response.Write "
Done
"%>
No comments:
Post a Comment