Microsoft Knowledge Base Article
This article contents is Microsoft Copyrighted material.
©2005-©2007 Microsoft Corporation. All rights reserved. Terms
of Use |
You receive unexpected errors when using ADO and ADO MD in a .NET Framework application
In a Microsoft .NET Framework application, you can use Microsoft ActiveX Data Objects (ADO) and Microsoft
ActiveX Data Objects (Multidimensional) (ADO MD) through COM interop. Sometimes, under stress, .NET Framework applications that use these technologies experience unexpected errors such as crashes and other intermittent exceptions. This is particularly common with multi-threaded applications such as those that run in Microsoft ASP.NET.
ADO and ADO MD were designed before the release of the .NET Framework, and were intended to be used in an unmanaged Component Object Model (COM) environment. Although you can access these technologies through COM interop, we do not recommend that you do this. This includes the use of the ADO Primary Interop Assembly that is included with Microsoft Visual Studio .NET.
Because they are not intended to be used in this way, ADO and ADO MD have not been heavily tested in interop scenarios.
We recommend that you use Microsoft ADO.NET or Microsoft ADOMD.NET instead of using classic ADO or ADO MD through interop. These technologies were developed specifically to provide data access in .NET Framework applications and do not require the added complexity of COM interop.
There will not be any future fixes or enhancements to these components to correct problems that only occur in a managed .NET Framework application. Generally, this does not affect future fixes or enhancements to ADO and ADO MD. We will continue to address issues that occur from the use of ADO and ADO MD in unmanaged applications, including Microsoft Visual Basic 6.0, Microsoft Visual C++, and Microsoft ASP.
To work around this problem in Microsoft ASP.NET, set the ASPCompat
attribute of the @ Page
directive to true
. When this attribute is set to true
, the page can be executed on a single-threaded apartment (STA) thread. Executing a page on an STA thread reduces the chance of unexpected multi-threaded access to the ADO object or to the ADO MD object. Note
Only use this as a temporary workaround while the code is being migrated to ADO.NET or to ADOMD.NET.
.NET Framework applications that use classic ADO must use the Primary Interop Assembly for ADO that is included with Visual Studio .NET. This workaround may reduce some problems. However, it may not prevent all issues. Do not use this workaround as a long-term solution.
ADO.NET is provided as part of the Microsoft .NET Framework. For more information about the .NET Framework, visit the following Microsoft Developer Network (MSDN) Web site:
The following file is available for download from the Microsoft Download Center:
Download the ADOMD.NET package now.
Collapse this imageExpand this image
For additional information about how to download Microsoft Support files, click the following article number to view the article in the Microsoft Knowledge Base:
How to Obtain Microsoft Support Files from Online Services
Microsoft scanned this file for viruses. Microsoft used the most current virus-detection software that was available on the date that the file was posted. The file is stored on security-enhanced servers that help to prevent any unauthorized changes to the file.
Article ID: 840667 - Last Review: December 27, 2006 - Revision: 1.4
- Microsoft ActiveX Data Objects 2.7
- Microsoft SQL Server 2000 Analysis Services
|kbtshoot kbprb kbinfo KB840667|Retired KB Content Disclaimer
This article was written about products for which Microsoft no longer offers support. Therefore, this article is offered "as is" and will no longer be updated.
Community Feedback System
Very often, it takes hours to solve a problem. Very often, you've looked high
and low, and have tried a lot of solutions. When you finally found it, chances
are, it was because someone else helped you. Here's your chance to give back.
Use our community feedback tool to let others know what worked for you and what
Please also understand that the community feedback system is not warranted to be
correct, it's simply a system that we've built to let people try and help each
other. If something in a feedback response doesn't make sense to you, or you're
not comfortable making changes that the feedback talks about (like registry
edits), please consult a professional.
Thank you for using kbAlertz.com Feedback System.
-- Scott Cate