ID: Q193093
The information in this article applies to:
Setting a Recordset's ActiveConnection property to a recordset object causes either a Dr. Watson or general protection fault (GPF) error to occur. For example:
Set rst.ActiveConnection = rst
Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article.
It is not recommended to set the ActiveConnection property to a recordset object. It is recommended that the Recordset's ActiveConnection property be set to an actual Connection object or connection string. The proper behavior would be for Visual Basic to respond with a trappable error since ActiveX Data Objects (ADO) is expecting a connection string or object.
1. Open a Standard .exe project in either Visual Basic 5.0 or 6.0.
2. From the Project menu, choose References, and then select the Microsoft
ActiveX Data Objects 2.0 or 1.5 Library.
3. Paste the following code into the form and enter the correct data
source in the ConnectionString parameter of the connection object:
Option Explicit
Dim cnn As ADODB.Connection
Dim rst As New ADODB.Recordset
Private Sub Form_Load()
Set cnn = New ADODB.Connection
cnn.Provider = "sqloledb"
cnn.Open "Data Source=<Your Server>;Initial Catalog=pubs;","sa",""
rst.ActiveConnection = rst 'This causes GPF or Dr. Watson error.
rst.Open "Select * from Authors"
End Sub
4. Run the project.
For more information on how to correctly open recordsets using ADO, please see the following article in the Microsoft Knowledge Base:
ARTICLE-ID: Q168336
TITLE : HOWTO: Three Ways to Open ADO Connection & Recordset Objects
Additional query words: kbADO150bug kbADO200bug kbADO150 kbADO200
Version : WINDOWS:1.5,2.0,5.0,6.0
Platform : WINDOWS
Issue type : kbbug
Solution Type : kbpending
Last Reviewed: September 28, 1998