BUG: You receive a "Syntax error or access violation" error message in ADO.NET when you run a query two times (812916)
The information in this article applies to:
- Microsoft ADO.Net 2.0
- Microsoft ADO.NET (included with the .NET Framework) 1.0
- Microsoft Visual Basic 2005
- Microsoft Visual Basic .NET (2002)
- Microsoft Visual Basic .NET (2003)
SYMPTOMSWhen 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 CAUSEWhen 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.WORKAROUNDTo 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: myRecordset = myCommand.Execute(, New Object() {myParameter}) STATUSMicrosoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.REFERENCES For additional information, click the following
article numbers to view the articles in the Microsoft Knowledge Base: 308499
PRB: Unhandled exception when you set an ADO property to a string in Visual Basic .NET
188857 PRB: Use
Open method to change CursorType and LockType
308047 How to open an ADO connection and Recordset objects by using Visual Basic .NET
Modification Type: | Minor | Last Reviewed: | 10/3/2006 |
---|
Keywords: | kbtshoot kbHotfixServer kbQFE kbvs2002sp1sweep kbProgramming kbTSQL kbDatabase kbCOMInterop kbWindowsForms kberrmsg kbbug KB812916 kbAudDeveloper |
---|
|