FIX: DTSTransferObjects with Events Generates an Error Message and an Access Violation in Visual Basic (316331)



The information in this article applies to:

  • Microsoft SQL Server 2000 (all editions)

This article was previously published under Q316331
BUG #: 356404 (SHILOH_BUGS)

SYMPTOMS

This article describes one possible reason why a Data Transformation Services (DTS) package created in Microsoft Visual Basic code may fail with an error message and an access violation (AV).

When you create a DTSTransferObjectsTask task in a DTS package and specify the WITHEVENTS keyword, and you then run the DTS package from Microsoft Visual Basic code, the package may fail with the following error message:
ErrorCode: -2147221499
Source: Microsoft Data Transformation Services (DTS) Package
Description: Need to run the object to perform this operation
After you set a breakpoint at the beginning of the OnProgress procedure, and you single step through your OnProgress code in Visual Basic, you will see the underlying access violation (AV):
Package failed error: x80040005, x80040000 + 5
Provider generated code execution exception: EXCEPTION_ACCESS_VIOLATION
Then, Dr. Watson shows an error message similar to the following:
The instruction at "0x0fa9183f" referenced memory at "0x00000001". The memory could not be "read".
When you run the Visual Basic application under the debugger WinDbg you will see a first chance exception of type access violation in OLEAUT32!SysAllocStringByteLen.

NOTE: This article is specifically about the OnProgress event of a DTSTransferObjectsTask!

The most common causes for the error message and access violation when you use DTS in Visual Basic applications are described in the following Microsoft Knowledge Base article:

271889 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

RESOLUTION

To resolve this problem, obtain the latest service pack for Microsoft SQL Server 2000. For additional information, click the following article number to view the article in the Microsoft Knowledge Base:

290211 INF: How To Obtain the Latest SQL Server 2000 Service Pack

NOTE: The following hotfix was created before the release of Microsoft SQL Server 2000 Service Pack 3.

The English version of this fix should have the following file attributes or later:
   Date          Time    Version    Size              File name
   --------------------------------------------------------------

   06-Jan-2002   20:23   8.00.566   1,901,120 bytes   Dtspkg.dll
				
NOTE: Because of file dependencies, the most recent hotfix or feature that contains the files may also contain additional files.


WORKAROUND

To work around this behavior, do not use DTSTransferObjectsTask with events.

NOTE: In contrast to the issue described in Microsoft Knowledge Base article 271889, you cannot workaround the problem by only providing comments as the body of the OnProgress procedure.

STATUS

Microsoft has confirmed that this is a problem in Microsoft SQL Server 2000.
This problem was first corrected in Microsoft SQL Server 2000 Service Pack 3.

REFERENCES

For additional information, click the article numbers below to view the articles in the Microsoft Knowledge Base:

221193 HOW TO: Install Data Transformation Services (DTS) Event Handlers in Visual Basic

271889 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


Modification Type:MinorLast Reviewed:9/27/2005
Keywords:kbHotfixServer kbQFE kbSQLServ2000sp3fix kbbug kbfix kbSQLServ2000preSP3fix KB316331