Wednesday, March 21, 2012

Package Execution with Custom UI

Hi:

I need a user to pass an input to a package from a VB form, and then want to show progress/errors in the form.

I have been able to use Application. LoadFromSqlServer and I then set pkg.Variables.(MyVariable) to the required value before calling Execute.

Works fine so far.

I dont know how to show progress. The DTSExecResult just returns a Cryptic Success /Failure status message.

Is there a way to log the errors if any to my Windows form? I have seen samples on Console Apps(see below) but I would prefer to show it in my Windows form in a text Box or something, appending each error result to the text.

TIA

Kartik

Code Snippet

Class EventListener
Inherits DefaultEvents

Public Overrides Function OnError(ByVal source As Microsoft.SqlServer.Dts.Runtime.DtsObject, _
ByVal errorCode As Integer, ByVal subComponent As String, ByVal description As String, _
ByVal helpFile As String, ByVal helpContext As Integer, _
ByVal idofInterfaceWithError As String) As Boolean

' Add application�Cspecific diagnostics here.
Console.WriteLine("Error in {0}/{1} : {2}", source, subComponent, description)
Return False

End Function

End Class

That's the code you want - you need to capture the events, and write to a text box instead of the console.

No comments:

Post a Comment