Article ID: 812916 - View products that this article applies to.
Caution ADO and ADO MD have not been fully tested in a Microsoft .NET Framework environment. They may cause intermittent issues, especially in service-based applications or in multithreaded applications. The techniques that are discussed in this article should only be used as a temporary measure during migration to ADO.NET. You should only use these techniques after you have conducted complete testing to make sure that there are no compatibility issues. Any issues that are caused by using ADO or ADO MD in this manner are unsupported. For more information, see the following article in the Microsoft Knowledge Base:
(http://support.microsoft.com/kb/840667/ )You receive unexpected errors when using ADO and ADO MD in a .NET Framework application
When you use the ActiveX Data Objects (ADO) Connection object in Microsoft Visual Basic .NET or Microsoft Visual Basic 2005 to run a SQL query that is associated with the ADODB.Command object two times consecutively, you may receive the following error message similar to:
An unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred in microsoft.visualbasic.dll
Additional information: Syntax error or access violation
When you use the ADODB.Connection object to run a SQL query that is associated with the ADODB.Command object, late binding is used. The error that is mentioned in the "Symptoms" section occurs because late binding the COM interop caches the results of the GetIDsOfNames method of the IDispatch Interface.
To work around this bug, use early binding instead of late binding to run the SQL query. You can use the Excecute method of the ADODB.Command object to run the SQL query, as shown in the following code:
Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.
Steps to reproduce the behavior
For additional information, click the following article numbers to view the articles in the Microsoft Knowledge Base:
(http://support.microsoft.com/kb/308499/ )PRB: Unhandled exception when you set an ADO property to a string in Visual Basic .NET
(http://support.microsoft.com/kb/188857/ )PRB: Use Open method to change CursorType and LockType
(http://support.microsoft.com/kb/308047/ )How to open an ADO connection and Recordset objects by using Visual Basic .NET
Article ID: 812916 - Last Review: December 27, 2007 - Revision: 3.2
Contact us for more help
Connect with Answer Desk for expert help.