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 biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can I execute a SQL Server 7 DTS package from an ASP page?

Status
Not open for further replies.

aolb

Programmer
Apr 16, 2002
180
GB
Can I execute a SQL Server 7 DTS package from an ASP page?

and if so how do I go about doing it?
 
Looks like it is possible. Take a look at "Microsoft Knowledge Base Article - Q252987" on support.microsoft.com. In case if you won't be able to find this article, here is the code:

<%@Language=VBScript %>
<% Option Explicit %>
<html>
<head>
<title>Q252987 Sample Code</title>
</head>
<body>

<%
Const DTSSQLStgFlag_Default = 0
Const DTSStepExecResult_Failure = 1

Dim oPkg, oStep, sMessage, bStatus

Set oPkg = Server.CreateObject(&quot;DTS.Package&quot;)
oPkg.LoadFromSQLServer &quot;MyServer&quot;,&quot;MyUser&quot;,&quot;MyPassword&quot;,DTSSQLStgFlag_Default,&quot;PackagePassword&quot;,&quot;&quot;,&quot;&quot;,&quot;MyPackage&quot;
oPkg.Execute()

bStatus = True

For Each oStep In oPkg.Steps
sMessage = sMessage & &quot;<p> Step [&quot; & oStep.Name & &quot;] &quot;
If oStep.ExecutionResult = DTSStepExecResult_Failure Then
sMessage = sMessage & &quot; failed<br>&quot;
bStatus = False
Else
sMessage = sMessage & &quot; succeeded<br>&quot;
End If
sMessage = sMessage & &quot;Task &quot;&quot;&quot; & oPkg.Tasks(oStep.TaskName).Description & &quot;&quot;&quot;</p>&quot;
Next

If bStatus Then
sMessage = sMessage & &quot;<p>Package [&quot; & oPkg.Name & &quot;] succeeded</p>&quot;
Else
sMessage = sMessage & &quot;<p>Package [&quot; & oPkg.Name & &quot;] failed</p>&quot;
End If

Response.Write sMessage
Response.Write &quot;<p>Done</p>&quot;

%>
</body>
</html>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top