Symptoms
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
Resolution
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.