Microsoft KB Archive/316331

From BetaArchive Wiki
Knowledge Base


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

Article ID: 316331

Article Last Modified on 9/27/2005



APPLIES TO

  • Microsoft SQL Server 2000 Standard Edition



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



Additional query words: copy object event handling BSTR

Keywords: kbbug kbfix kbsqlserv2000presp3fix kbqfe kbsqlserv2000sp3fix kbhotfixserver KB316331