How execute DTS from a ASP



Hello,
I have found the script that allow to execute the DTS from asp but I have a
qeston

It is possible to execute the script from a ASP page that is on a IIS on a
different server of SQL server?

If yes How?


folowing is the ASP script that I have found

<%@Language=VBScript %>
<% ' 207
Option Explicit
Response.Buffer = False
%>

<%
Const DTSSQLStgFlag_Default = 0
Const DTSStepExecResult_Failure = 1

Dim oPkg, oStep, sErr, bSuccess

Dim sServer, iSecurity, sUID, sPWD, sPkgName, sPkgPWD

' Get Form Variables
sServer = Request.Form("txtServer")
iSecurity = CInt("0" & Request.Form("optSecurity"))
sUID = Request.Form("txtUID")
sPWD = Request.Form("txtPWD")
sPkgName = Request.Form("txtPkgName")
sPkgPWD = Request.Form("txtPkgPWD")

' Validate Variables
If Len(sServer) = 0 Then sErr = "<li>Invalid Server Name"
If iSecurity = 0 And Len(sUID) = 0 Then _
sErr = sErr & "<li>Invalid Username for SQL Security"
If Len(sPkgName) = 0 Then sErr = sErr & "<li>Invalid Package Name"


If Len(sErr) = 0 Then
Response.Write "<p>Executing " & sPkgName & " from " & _
sServer & "</p>"

' Load the Package Set
oPkg = Server.CreateObject("DTS.Package")
oPkg.LoadFromSQLServer sServer, sUID, sPWD, iSecurity , sPkgPWD, "", "",
sPkgName

' Execute the Package
oPkg.Execute

bSuccess = True

' Report Step status
For Each oStep In oPkg.Steps
sErr = sErr & "<p> Step [" & oStep.Name & "] "
If oStep.ExecutionResult = DTSStepExecResult_Failure Then
sErr = sErr & " failed<br>"
bSuccess = False
Else
sErr = sErr & " succeeded<br>"
End If
sErr = sErr & "Task """ & _
oPkg.Tasks(oStep.TaskName).Description & """</p>"
Next

If bSuccess Then
sErr = sErr & "<p>Package [" & oPkg.Name & "] succeeded</p>"
Else
sErr = sErr & "<p>Package [" & oPkg.Name & "] failed</p>"
End If
End If

' Clean Up
oPkg.UnInitialize
Set oStep = Nothing
Set oPkg = Nothing

Response.Write sErr
Response.Write "<p>Done</p>"

%>




thank you
Milani Omar


.



Relevant Pages

  • Re: Using Server.CreateObject with ASP and IIS 5.0
    ... Active Server Pages, ASP 0113 ... The maximum amount of time for a script to execute was exceeded. ...
    (microsoft.public.office.developer.web.components)
  • How do I request user right: SeShutdownPrivilege
    ... IIS, ASP enabled, execute mode: script and executables. ... I do not seem to have it, when I run an ASP script on the server ...
    (microsoft.public.windows.server.security)
  • LDAP and ASP
    ... i would execute a script who modify properties of USER ... My script is an ASP page, but i have an error for modify the properties: ... The user who execute my page don't have right to do this. ...
    (microsoft.public.scripting.vbscript)
  • How to call perl programs from ASP page
    ... I'm new to Perl and I'm trying to excute/call a perl program from Perl ... Script in an ASP page. ... execute lots of Perl code in my ASP pages with no problem, ...
    (perl.beginners)
  • Re: Problem with ASP on Webserver
    ... There is no ActiveX object involved in this problem, we only request a ASP ... function in the script ... (Accept-Language:) ...
    (microsoft.public.windowsce.platbuilder)

Quantcast