dbTalk Databases Forums  

Running DTS Custom Task from VB .Net

microsoft.public.sqlserver.dts microsoft.public.sqlserver.dts


Discuss Running DTS Custom Task from VB .Net in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Brett Ossman
 
Posts: n/a

Default Running DTS Custom Task from VB .Net - 05-27-2005 , 08:31 AM






Created a DTS package and executed it successfully from a VB .Net program via
the DTS Package Object. I then added a third party custom task to the
package via the DTS designer. I can still run the package successfully from
Enterprise Manager or DTSRun. However, running it in the VB .Net program now
gives an error along the lines of the specified module is not found. Again,
the DTS package runs fine in the .Net program without the custom task in it.
I tried adding a reference to the custom task DLL in the VB project, but did
not help.

Any ideas?

Thanks

Reply With Quote
  #2  
Old   
Brett Ossman
 
Posts: n/a

Default RE: Running DTS Custom Task from VB .Net - 05-31-2005 , 08:20 AM






FYI, here's the code, which works fine without the custom task in the DTS.

Private Sub btnLoadBatchSecurityRequests_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
btnLoadBatchSecurityRequests.Click
Dim dtsLoadBatchRequests As DTS.Package
Dim strFormName As String = ""
Dim strErrorMessage As String = ""
Dim connSQL As SqlConnection
Dim cmdSQL As SqlCommand
Dim strSQLConnection As String =
ConfigurationSettings.AppSettings("DSN")

lblBatchLoaded.Visible = True
lblBatchLoaded.ForeColor = Color.Red
lblBatchLoaded.Text = "Batch Loading !"
Try
dtsLoadBatchRequests = New DTS.Package

'Begin - set up events sink
Dim cpContainer As UCOMIConnectionPointContainer
cpContainer = CType(dtsLoadBatchRequests,
UCOMIConnectionPointContainer)
Dim cpPoint As UCOMIConnectionPoint
Dim PES As PackageEventsSink = New PackageEventsSink
Dim guid As Guid = _
New Guid("10020605-EB1C-11CF-AE6E-00AA004A34D5")
cpContainer.FindConnectionPoint(guid, cpPoint)
Dim intCookie As Integer
cpPoint.Advise(PES, intCookie)
'End - set up events sink

' Load and execute DTS package
connSQL = New SqlConnection(strSQLConnection)
connSQL.Open()
dtsLoadBatchRequests.LoadFromSQLServer(connSQL.Dat aSource,
"blahblahblah", "blahblahblah", _
DTSSQLServerStorageFlags.DTSSQLStgFlag_Default, _
"", "", "", "PCANetWeb - Batch Security Requests", Nothing)
dtsLoadBatchRequests.Execute()
' End - Load and execute DTS package

dtsLoadBatchRequests.UnInitialize()
dtsLoadBatchRequests = Nothing
cpPoint.Unadvise(intCookie)
cpPoint = Nothing
cpContainer = Nothing
PES = Nothing
lblBatchLoaded.ForeColor = Color.Green
lblBatchLoaded.Text = "Batch Loaded Successfully !"
Catch exc As Exception
strFormName = Server.HtmlEncode("Load Batch Requests")
strErrorMessage = Server.HtmlEncode("Batch Load Failed. Please
contact Customer Care.")
Response.Redirect("../intranet/form_deny.asp?form_name=" &
strFormName & Chr(38) & "error_message=" & strErrorMessage)
Finally
End Try
End Sub
Public Class PackageEventsSink
Implements DTS.PackageEvents
Overridable Overloads Sub OnError(ByVal EventSource As String, _
ByVal ErrorCode As Integer, ByVal Source As String, _
ByVal Description As String, ByVal HelpFile As String, _
ByVal HelpContext As Integer, ByVal IDofInterfaceWithError
As String, _
ByRef pbCancel As Boolean) Implements
DTS.PackageEvents.OnError
End Sub
Overridable Overloads Sub OnFinish(ByVal EventSource As String) _
Implements DTS.PackageEvents.OnFinish
End Sub
Overridable Overloads Sub OnProgress(ByVal EventSource As String, _
ByVal ProgressDescription As String, ByVal PercentComplete
As Integer, _
ByVal ProgressCountLow As Integer, ByVal ProgressCountHigh
As Integer) _
Implements DTS.PackageEvents.OnProgress
End Sub
Overridable Overloads Sub OnQueryCancel(ByVal EventSource As String, _
ByRef pbCancel As Boolean) Implements
DTS.PackageEvents.OnQueryCancel
pbCancel = False
End Sub
Overridable Overloads Sub OnStart(ByVal EventSource As String) _
Implements DTS.PackageEvents.OnStart
End Sub
End Class


Reply With Quote
Reply




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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.