BUG: WillChangeRecordset Event Not Executed

ID: Q191455


The information in this article applies to:


SYMPTOMS

When the Close method of an ActiveX Data Objects (ADO) RecordSet object is called, the WillChangeRecordset event does not fire. The documentation states, in error, that this event fires when closing the RecordSet.


STATUS

Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article.


MORE INFORMATION

Steps to Reproduce Behavior

  1. Create a Standard EXE Project in Visual Basic.


  2. From Project menu, choose Components and then select "Microsoft ActiveX Data Objects 2.0 Library".


  3. Add a TextBox control and Command Button to the form.


  4. Add the following code to the General Declarations of the form:
    
    
       Dim WithEvents rst As ADODB.Recordset
       Dim cn As New ADODB.Connection
    
       Private Sub Form_Load()
       With cn
       .CursorLocation = adUseClient
       .Open "dsn=pubs;uid=sa;pwd=;"
       End With
    
       Set rst = cn.Execute("Select * from Authors", , adOpenKeyset)
       Set Text1.DataSource = rst
       Text1.DataField = "au_lname"
    
       End Sub
    
       Private Sub rst_WillChangeRecordset(ByVal adReason As _
         ADODB.EventReasonEnum, adStatus As ADODB.EventStatusEnum, _
         ByVal pRecordset As ADODB.Recordset)
         Debug.Print "ADO WillChangeRecordset"
    
       End Sub
    
       Private Sub Command1_Click()
         Debug.Print "About to Close"
    
         rst.Close
    
         Debug.Print "Close complete"
         Unload Me
    
       End Sub 


NOTE: The preceding code sample assumes that you have a DSN that points to a valid SQL Server and the Pubs database.

NOTE: It is printed when the RecordSet object is first created on the cn.Execute line.


REFERENCES

For additional information about ActiveX Data Objects (ADO) events, please refer to the Data Access Software Development Kit (DASDK), Microsoft Data Access Components (MDAC) or the Visual Studio 6.0 documentation.

For the latest ActiveX Data Objects (ADO) information and updates please see the following URL:

http://www.microsoft.com/data/

Additional query words: kbdocerr kbADO200bug kbdse kbcode


Keywords          : 
Version           : WINDOWS:2.0
Platform          : WINDOWS 
Issue type        : kbbug 

Last Reviewed: February 9, 1999