Microsoft Knowledge Base Article
This article contents is Microsoft Copyrighted material.
©2005-©2007 Microsoft Corporation. All rights reserved.
Terms
of Use |
Trademarks
Article ID: 314639 - Last Review: April 6, 2004 - Revision: 6.1
BUG: Access Violation Occurs When You Open a Recordset with a Different Lock Type
This article was previously published under Q314639
If you close a recordset, and then reopen the recordset with a different lock type, an access violation may occur.
There is no known workaround for this problem.
Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.
Steps to Reproduce Behavior
- Create a new Visual Basic project. Form1 is created by default.
- Double-click Form1, and then paste the following code in the Form_Load event:
Dim cn As New ADODB.Connection
Dim rs As New ADODB.Recordset
cn.Open "DSN=Pubs;UID=sa;PWD=;" ' Replace this connection string with one valid on your system, pointing to the Pubs sample database.
Set rs.ActiveConnection = cn
rs.CursorLocation = adUseClient
rs.Open "select * from authors", , adOpenDynamic, adLockOptimistic
rs.Close
rs.Open "select * from authors", , adOpenDynamic, adLockReadOnly
- Run the project.
APPLIES TO
- Microsoft Data Access Components 2.1
- Microsoft Data Access Components 2.5
- Microsoft Data Access Components 2.7
- Microsoft Data Access Components 2.6
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
didn't.
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