Hi,
When I try executing DTS package FROM ASP I received this error :
Executing DTS_PACKG_1 from server_name
1
Step [DTSStep_DTSDataDrivenQueryTask_1] failed
Task "Data Driven Query Task: UPDATE TABLE ..."
Package [DTS_PACKG_1] failed
Done
The code I am using is as below :
<%@Language=VBScript %>
<% ' 207
Option Explicit
Response.Buffer = False
%>
<html>
<head>
<title>DTS</title>
</head>
<body>
<%
Const DTSSQLStgFlag_Default = 0
Const DTSStepExecResult_Failure = 1
Dim oPkg, oStep, sErr, bSuccess
Dim sServer, iSecurity, sUID, sPWD, sPkgName, sPkgPWD
' Get Form Variables
sServer = "server_name"
sPkgName = "DTS_PACKG_1"
sPkgPWD = ""
sUID = ""
sPWD = ""
' 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, "", "",256, , , , sPkgName
' Execute the Package
oPkg.Execute
bSuccess = True
' Report Step status
For Each oStep In oPkg.Steps
Response.Write "<br>" & oStep.ExecutionResult & "<br>"
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>"
%>
</body>
</html>
I use the following Connection string to access data from sql server using ASP
Conn.Open "PROVIDER=SQLOLEDB;SERVER=server_name;INTEGRATED SECURITY=SSPI;DATABASE=DBNm;"
(this is just to give you an idea of the environment i am working)
Thanks in advance,
RajKum.
When I try executing DTS package FROM ASP I received this error :
Executing DTS_PACKG_1 from server_name
1
Step [DTSStep_DTSDataDrivenQueryTask_1] failed
Task "Data Driven Query Task: UPDATE TABLE ..."
Package [DTS_PACKG_1] failed
Done
The code I am using is as below :
<%@Language=VBScript %>
<% ' 207
Option Explicit
Response.Buffer = False
%>
<html>
<head>
<title>DTS</title>
</head>
<body>
<%
Const DTSSQLStgFlag_Default = 0
Const DTSStepExecResult_Failure = 1
Dim oPkg, oStep, sErr, bSuccess
Dim sServer, iSecurity, sUID, sPWD, sPkgName, sPkgPWD
' Get Form Variables
sServer = "server_name"
sPkgName = "DTS_PACKG_1"
sPkgPWD = ""
sUID = ""
sPWD = ""
' 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, "", "",256, , , , sPkgName
' Execute the Package
oPkg.Execute
bSuccess = True
' Report Step status
For Each oStep In oPkg.Steps
Response.Write "<br>" & oStep.ExecutionResult & "<br>"
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>"
%>
</body>
</html>
I use the following Connection string to access data from sql server using ASP
Conn.Open "PROVIDER=SQLOLEDB;SERVER=server_name;INTEGRATED SECURITY=SSPI;DATABASE=DBNm;"
(this is just to give you an idea of the environment i am working)
Thanks in advance,
RajKum.