BUG: Access Violation Occurs When You Open a Recordset with a Different Lock Type (314639)



The information in this article 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

This article was previously published under Q314639

SYMPTOMS

If you close a recordset, and then reopen the recordset with a different lock type, an access violation may occur.

RESOLUTION

There is no known workaround for this problem.

STATUS

Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.

MORE INFORMATION

Steps to Reproduce Behavior

  1. Create a new Visual Basic project. Form1 is created by default.
  2. 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
    					
  3. Run the project.

Modification Type:MajorLast Reviewed:4/6/2004
Keywords:kbbug kbfix KB314639