Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > SQL Server > SQL Server DTS
Password Reminder
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Display Modes
  #1 (permalink)  
Old June 5th, 2003, 12:20 PM
Registered User
Join Date: Jun 2003
Location: Middleton, WI, USA.
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"

    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

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

    Main = DTSTaskExecResult_Success
End Function

Any feedback is appreciated.

  #2 (permalink)  
Old June 5th, 2003, 05:34 PM
Registered User
Join Date: Jun 2003
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts

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:

objDTSPackage.Uninitialize() ' <---- Here

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

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

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 12:02 PM
DTS and ActiveX VB Script gscott SQL Server DTS 6 May 16th, 2007 08: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 09:13 AM

All times are GMT -4. The time now is 06:42 AM.

Powered by vBulletin®
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.