Home   |   Asp.Net 2.0   |   .Net Framework 2.0   |   IIS 6.0   |   Sql Server 2005   |   Visual Basic 2005   |   c# 2005   |   VS 2005   |   Visual Source Safe 2005

MS Dynamics CRM 3.0

SharePoint Portal Server 2003
SharePoint Server 2007
Dynamics NAV
Dynamics CRM
SharePoint Designer 2007
SharePoint Portal Server 2001
Windows SharePoint Services
Windows SharePoint Services 3.0
Project Server 2003
Project Server 2007
Dynamics – Point of Sale
Dynamics AX
Dynamics GP
Dynamics Retail Management System (RMS)
Dynamics SL
SQL Server 2000
Visual Basic .NET 2003
Visual C# .NET 2003
Visual C++ .NET 2003
Visual C++ 2005
Visual SourceSafe 6.0
Windows Server 2003
Windows Server 2003
Outlook 2003
ADO.NET 1.1
ASP.NET 1.0
Visual Studio Team Foundation Server
Visual Studio 2005 Team Edition
Windows Internet Explorer 7
BizTalk Server 2000
BizTalk Server 2002
BizTalk Server 2004
BizTalk Server 2006
Visual Studio 6.0
Access 2000
Access 2002
Access 2003
Access 2007
Access 97
Collaboration Data Objects 2.0
Commerce Server 2002
Content Management Server 2001
Commerce Server 2007
Content Management Server 2002
Data Access Components 2.7
Data Access Components 2.8
DirectX 9.0b
Office Small Business Accounting 2006
Accounting 2007
ActiveSync 4.1
Class Server 2.0
Groove 2007
Windows Vista
Outlook 2007
OneNote 2003
OneNote 2007
Office X for Mac
Zune software
Zune Live
Zoo Tycoon 2
Flight Simulator 2002
Dungeon Siege II

Cervo Technologies
The Right Source to Outsource

Oracle Database FAQS

Sharepoint Portal Server KB

Outlook 2007 Knowledge Base Articles

Data Access Components 2.7 Knowledge Base Articles

When you attempt to disconnect an ADO Recordset by setting its ActiveConnection Object property to Nothing , the following error message might appear: Run-time error '3705': Operation is not allowed when the object is open. Only client-side ADO...


When you attempt to disconnect an ADO Recordset by setting its ActiveConnection Object property to Nothing, the following error message might appear:
Run-time error '3705': Operation is not allowed when the object is open.

CAUSE

Only client-side ADO recordsets can be disconnected. The specified error occurs only when you attempt to disconnect a server-side ADO recordset.

RESOLUTION

Set the CursorLocation property of the ADO Recordset to adUseClient.

STATUS

This behavior is by design.

MORE INFORMATION

Steps to Reproduce Behavior

Run the following steps to reproduce this error message by using a Standard EXE Visual Basic 6.0 project. The sample code establishes an ADO connection to the SQL Server PUBS sample database and opens an ADO Recordset on the Authors table. You can modify the ADO connection string to connect to a database of your choice if you do not have the SQL Server PUBS sample database.
1.Open a new Standard EXE project in Visual Basic 6.0. Form1 is created by default.
2.On the Project menu, select References, and then set a reference to the Microsoft ActiveX Data Objects 2.x Library.
3.Add a CommandButton to Form1.
4.Copy and paste the following code in the form module:
Private Sub Command1_Click()

Dim cn As ADODB.Connection
Dim rs As ADODB.Recordset

Set cn = New ADODB.Connection
Set rs = New ADODB.Recordset

'Place cn.CursorLocation = adUseClient here
cn.Open "Provider=SQLOLEDB;Data Source=<SQL Server>;Initial Catalog=pubs;User Id=<UID>;Password=<PWD>" 
rs.Open "Select * from authors", cn, adOpenStatic, adLockBatchOptimistic

Set rs.ActiveConnection = Nothing

rs.Close
cn.Close

End Sub
					
5.Save and run the project.
6.Click the CommandButton on Form1, and note that the error message specified in the "Symptoms" section of this article appears. Clicking Debug in the error message window breaks on the Set rs.ActiveConnection = Nothing statement.
7.Stop the running of the project and add the following line of code before the cn.Open statement:
cn.CursorLocation = adUseClient
					
8.Save and run the project again, and note that error message 3705 does not occur, and that the recordset gets disconnected as expected.


APPLIES TO
Microsoft ActiveX Data Objects 2.0
Microsoft ActiveX Data Objects 2.1
Microsoft ActiveX Data Objects 2.1 Service Pack 1
Microsoft ActiveX Data Objects 2.1 Service Pack 2
Microsoft ActiveX Data Objects 2.5
Microsoft ActiveX Data Objects 2.6
Microsoft ActiveX Data Objects 2.7
Microsoft Data Access Components 2.0
Microsoft Data Access Components 2.1
Microsoft Data Access Components 2.1 Service Pack 1
Microsoft Data Access Components 2.1 Service Pack 2
Microsoft Data Access Components 2.5
Microsoft Data Access Components 2.5 Service Pack 1
Microsoft Data Access Components 2.6
Microsoft Data Access Components 2.7
Microsoft Visual Basic 5.0 Professional Edition
Microsoft Visual Basic 6.0 Professional Edition
Microsoft Visual Basic 5.0 Enterprise Edition
Microsoft Visual Basic 6.0 Enterprise Edition

Keywords: 
kbprb KB275927

Copyright © 2004 - 2007 Gridview.org, Inc. All rights reserved. Powered by Smart Web Content Management System