Microsoft KB Archive/272618

= PRB: Client-Side ADO Union Query Using Oracle OLE DB Provider Returns Incorrect Number of Columns =

Article ID: 272618

Article Last Modified on 8/23/2001

-

APPLIES TO


 * Microsoft Visual Basic 6.0 Professional Edition
 * Microsoft Visual Basic 6.0 Enterprise Edition
 * Microsoft Data Access Components 2.5
 * Microsoft Data Access Components 2.5 Service Pack 1

-



This article was previously published under Q272618



SYMPTOMS
When you create a recordset with ADO 2.5 that contains a Union Query, client-side cursors and the Microsoft Oracle OLE DB Provider return an incorrect number of columns.

This problem does not occur if you use the OLE DB Provider for ODBC Drivers and the Microsoft ODBC for Oracle Drive.



STATUS
Microsoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article.



Steps to Reproduce Behavior
 Create a new Visual Basic Standard EXE project. Form1 is created by default. Set a Reference to Microsoft ActiveX Objects 2.5.  Paste the following code into the Form1 code window: Private Sub Form_Load Dim cn As New ADODB.Connection Dim rs As New ADODB.Recordset On Error Resume Next

cn.CursorLocation = adUseClient

'ODBC 'cn.Open cn.Open &quot;Provider=MSDASQL;Driver={Microsoft ODBC for Oracle};Server=YourOracleAlias;Uid=demo;pwd=demo&quot;

'OLEDB cn.Open &quot;Provider=MSDAORA;Data Source=YourOracleAlias;User ID=demo;Password=demo&quot;

cn.Execute &quot;Drop table oratest&quot; cn.Execute &quot;CREATE TABLE ORATEST(Col1 VARCHAR2(10) NULL, Col2 VARCHAR2(10) NULL)&quot; cn.Execute &quot;CREATE TABLE DUAL(Col1 VARCHAR2(10) NULL)&quot; rs.Open &quot;select col1, col2 from oratest where col1 in (Select 1 from dual union select 2 from dual)&quot;, _ cn, adOpenStatic, adLockBatchOptimistic

MsgBox rs.Fields.Count

End Sub  Make the necessary connection string changes, and then run the project.Results: The message box displays a &quot;1.&quot;

 Stop the project, and uncomment the connect line following &quot;'ODBC,&quot; and comment the line following &quot;'OLEDB.&quot;Results: The message box displays a &quot;2,&quot; which is correct.

Keywords: kbprb kbpending KB272618

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.