Article ID: 253674
Article Last Modified on 8/23/2001
APPLIES TO
- 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 Visual Basic 6.0 Professional Edition
- Microsoft Visual Basic 6.0 Enterprise Edition
This article was previously published under Q253674
SYMPTOMS
When creating an ADO recordset using an Oracle Decode statement that returns null values, ADO generates the following error message:
NOTE: This error does not occur when you use the Oracle 8.1.6 client.
RESOLUTION
Change the CursorLocation to adUseServer.
STATUS
Microsoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article.
MORE INFORMATION
Steps to Reproduce Behavior
- Start Visual Basic and create a Standard Exe project. Create a reference to Microsoft ActiveX Data Objects 2.1 or later.
Place the following code into Form1.
Dim cn As New ADODB.Connection Dim rs As New ADODB.Recordset Private Sub Form_Load() 'Comment out the line below to make it work. cn.CursorLocation = adUseClient cn.Open "Provider=MSDAORA;Data Source=YourOraclealias;User ID=YourUserID;Password=YourPassword" rs.Open "select decode(employee_id,'7394','matches','') from employee", cn, adOpenKeyset, adLockOptimistic Debug.Print rs(0) End Sub
- Change the ConnectionString to use a valid Data Source.
- Run the project.Result: The above mentioned run-time error.
- Comment this line of code: cn.CursorLocation = adUseClient
- Run the project again.Result: No errors. The recordset contains nulls but is valid.
REFERENCES
Keywords: kboracle kbprb KB253674