Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Visual Basic > VB.NET 1.0 > Pro VB.NET 2002/2003
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Pro VB.NET 2002/2003 For advanced Visual Basic coders working .NET version 2002/2003. Beginning-level questions will be redirected to other forums, including Beginning VB.NET.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro VB.NET 2002/2003 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
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old June 19th, 2007, 12:35 AM
Registered User
 
Join Date: Jun 2007
Location: Bangalore, Karnataka, India.
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to hari_vjti
Default DTS package error Plz Help

Hi Iam facing a problem with DTS package. and i was trying to execute the code which u gave in this site

type casting error is coming at this line

 oCustomTask = oTask.CustomTask

full code is below

Dim oPackage As New DTS.Package2()
        Dim oConnection As DTS.Connection
        Dim oStep As DTS.Step2
        Dim oTask As DTS.Task
        Dim oCustomTask As DTS.BulkInsertTask

        Try
            oConnection = oPackage.Connections.New("SQLOLEDB")
            oStep = oPackage.Steps.New
            oTask = oPackage.Tasks.New("DTSBulkInsertTask")
            oCustomTask = oTask.CustomTask
            With oConnection
                oConnection.Catalog = "pubs"
                oConnection.DataSource = "(local)"
                oConnection.ID = 1
                oConnection.UseTrustedConnection = True
                oConnection.UserID = "Tony Patton"
                oConnection.Password = "Builder"
            End With
            oPackage.Connections.Add(oConnection)
            oConnection = Nothing
            With oStep
                .Name = "GenericPkgStep"
                .ExecuteInMainThread = True
            End With
            With oCustomTask
                .Name = "GenericPkgTask"
                .DataFile = "c:\dts\authors.txt"
                .ConnectionID = 1
                .DestinationTableName = "pubs..authors"
                .FieldTerminator = "|"
                .RowTerminator = "\r\n"
            End With
            oStep.TaskName = oCustomTask.Name
            With oPackage
                .Steps.Add(oStep)
                .Tasks.Add(oTask)
                .FailOnError = True
            End With
            oPackage.Execute()

        Catch ex As Exception
            MsgBox("Error: " & CStr(Err.Number) & vbCrLf _
        & Err.Description, vbExclamation, oPackage.Name)
        Finally
            oConnection = Nothing
            oCustomTask = Nothing
            oTask = Nothing
            oStep = Nothing
            If Not (oPackage Is Nothing) Then
                oPackage.UnInitialize()
            End If
        End Try


PLZ help me out of this, iam struggling a lot with this error....plz give me suggestion

Regards

hari


Hari
Sr Sw Engg
SAP India-Bangalore
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
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
Help with DTS PACKAGE mxwebb SQL Server DTS 1 November 28th, 2007 05:16 PM
DTS Package - Default database error interlogics SQL Server DTS 0 December 9th, 2005 06:30 AM
DTS Package Deployment acdsky VB Databases Basics 1 February 22nd, 2004 12:25 PM
DTS package Invalid Class error digriz60 SQL Server DTS 1 November 11th, 2003 01:41 PM



All times are GMT -4. The time now is 09:09 PM.


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