Wrox Programmer Forums
Go Back   Wrox Programmer Forums > SQL Server > SQL Server DTS
|
SQL Server DTS Discussion specific to Data Transformation Service with SQL Server. General SQL Server discussions should use the general SQL Server forum. Readers of the book Professional SQL Server 2000 DTS with questions specific to that book should post in that book forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server DTS section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 5th, 2003, 11:20 AM
Registered User
 
Join Date: Jun 2003
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to kpowers@wppisys.org
Default DTS & VB script error

I have a job in SQLAgent that calls a DTS Package using vb script and errors out. I have written a vb app. that does the same thing with pretty much the same code and it doesn't error. I get the following error:

ActiveScripting specific error 257 occurred. The step failed.

Here is the script:

Dim adoRs
Dim adoConn
Dim adoCmd
Dim strSQL
Dim objDTSPackage

Set adoRs = CreateObject("ADODB.Recordset")
Set adoConn = CreateObject("ADODB.Connection")
Set adoCmd = CreateObject("ADODB.Command")

Function Main()
    adoConn.Provider = "SQLOLEDB"
    adoConn.ConnectionString = "User ID=WPPI_HDWH;Password=xxxx;" & "Data Source=WPPIWEB;" & "Initial Catalog=WPPI_HDWH"
             adoConn.Open

    adoRs.ActiveConnection = adoConn
    adoRs.OPen "Select * from WPPI_Main_Load_Globals order by prefix"

             Do Until adoRs.EOF



          Set objDTSPackage = CreateObject("DTS.Package")
           objDTSPackage.LoadFromSQLServer "WPPIWEB", "WPPI_HDWH", "hdwh98", DTSSQLStgFlag_UseTrustedConnection, , , , "WPPI_MAIN_LOAD"
           objDTSPackage.GlobalVariables("ODBC").Value = adoRs.Fields("ODBC").value
           objDTSPackage.GlobalVariables("Load_Consmonth_SQL" ).Value = adoRs.Fields("Load_Consmonth_SQL").value
           objDTSPackage.GlobalVariables("Delete_Data").Value = adoRs.Fields("Delete_Data").value
           objDTSPackage.GlobalVariables("Update_Utility_Info ").Value = adoRs.Fields("Update_Utility_Info").value
           objDTSPackage.GlobalVariables("Pu_Account").Value = adoRs.Fields("Pu_Account").value
           objDTSPackage.GlobalVariables("Pu_Account_Pay").Va lue = adoRs.Fields("Pu_Account_Pay").value
           objDTSPackage.GlobalVariables("Pu_Elec_Hist").Valu e = adoRs.Fields("Pu_Elec_Hist").value
           objDTSPackage.GlobalVariables("Pu_Stats").Value = adoRs.Fields("Pu_Stats").value
           objDTSPackage.GlobalVariables("Pujhhdrh").Value = adoRs.Fields("Pujhhdrh").value
           objDTSPackage.GlobalVariables("Pujhstat").Value = adoRs.Fields("Pujhstat").value
           objDTSPackage.GlobalVariables("Pujhstat_Consmonth" ).Value = adoRs.Fields("Pujhstat_Consmonth").value
           objDTSPackage.GlobalVariables("Hr_Pu_Elec_Rates"). Value = adoRs.Fields("Hr_Pu_Elec_Rates").value
           objDTSPackage.GlobalVariables("Hr_Pu_Stat_Codes"). Value = adoRs.Fields("Hr_Pu_Stat_Codes").value
           objDTSPackage.GlobalVariables("Pu_Flat_Bill").Valu e = adoRs.Fields("Pu_Flat_Bill").value
           objDTSPackage.GlobalVariables("Pu_Cat_Code").Value = adoRs.Fields("Pu_Cat_Code").value
           objDTSPackage.Execute
                  adoRs.MoveNext
             Loop

    Set objDTSPackage = Nothing
    Set adoRs = nothing
    Set adoConn = nothing
    Set adoCmd = nothing

    Main = DTSTaskExecResult_Success
End Function

Any feedback is appreciated.

Ken
 
Old June 5th, 2003, 04:34 PM
Registered User
 
Join Date: Jun 2003
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

First of all, you should use the Uninitialize() method of the package object for every object you create, ie add the following line just before the "Loop" statement:

adoRs.MoveNext
objDTSPackage.Uninitialize() ' <---- Here
Loop

Except from that, you should use msgbox'es to debug your code, to see if there is a specific place that the error occurs.





Similar Threads
Thread Thread Starter Forum Replies Last Post
'expected then' VB script compilation error Adam H-W Classic ASP Basics 9 July 19th, 2009 11:02 AM
DTS and ActiveX VB Script gscott SQL Server DTS 6 May 16th, 2007 07:38 AM
type mismatch error in VB Script spierson99 SQL Server DTS 2 February 20th, 2006 12:13 PM
asp vb script error rsjaladi Classic ASP Databases 2 November 26th, 2004 10:46 AM
DTS Transform Data Task VB Script problem jan.aitken SQL Server DTS 0 May 28th, 2004 08:13 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.