PRB: Error message: "Exception Access Violation 2147221499.Need to run the object to perform this operation" occurs when you run a DTS package in Microsoft Visual Basic code (271889)
The information in this article applies to:
- Microsoft SQL Server 7.0
- Microsoft SQL Server 2000 (all editions)
This article was previously published under Q271889 SYMPTOMS
This article describes one possible reason as to why a Data Transformation Services (DTS) package created in Microsoft Visual Basic code may fail with an access violation (AV) error message.
When you create a DTS package by using the WITHEVENTS keyword, and you then run the DTS package from within Microsoft Visual Basic code, the package fails with an access violation and the following error message occurs:
Microsoft dts package provider generated code execution exception;
exception access violation 2147221499.Need to run the object to
perform this operation.
CAUSE
The following five events are associated with a DTS package when the DTS package is created by using the WITHEVENTS clause:
Private Sub <object>_OnError(ByVal EventSource As String, _
ByVal ErrorCode As Long, _
ByVal Source As String, _
ByVal Description As String, _
ByVal HelpFile As String, _
ByVal HelpContext As Long, _
ByVal IDofInterfaceWithError As String, _
ByRef pbCancel As Boolean)
Private Sub <object>_OnFinish(ByVal EventSource As String)
Private Sub <object>_OnProgress(ByVal EventSource As String, _
ByVal ProgressDescription As String, _
ByVal PercentComplete As Long, _
ByVal ProgressCountLow As Long, _
ByVal ProgressCountHigh As Long)
Private Sub <object>_OnQueryCancel(ByVal EventSource As String, _
ByRef pbCancel As Boolean)
Private Sub <object>_OnStart(ByVal EventSource As String)
If code for these events is not present, the error message described in the "Symptoms" section occurs.
For more information about these events, please see the following article in the Microsoft Knowledge Base:
221193 How to install Data Transformation Services (DTS) event handlers in Visual Basic
WORKAROUNDNote Implement the work around discussed in this section only if the DTS package is created by using the WITHEVENTS keyword.
To work around this problem:
- Specify some dummy code for the five events.
-or-
- Comment out the five events.
The sample code that follows demonstrates where an event handler is either commented out or valid code is specified:
Private Sub mobjDTS_OnFinish(ByVal EventSource As String)
' this is a comment.(or this piece should be replaced with the appropriate code for each of the five events.)
End Sub
You would also have to make similar changes for the other four events.
Modification Type: | Minor | Last Reviewed: | 12/28/2005 |
---|
Keywords: | kbCodeSnippet kbfix kbprb KB271889 kbAudDeveloper |
---|
|