Solved

Problem in reading records of Oracle  in VB

Posted on 2002-07-17
3
140 Views
Last Modified: 2010-05-02
I have one table in my oracle database (version 8.1.7) ProductClassification
 which has following fields
 
 Name                Null?    Type
 ------------------ -------- --------------------------
 ID                           NUMBER(38)
 DESCRIPTION                  VARCHAR2(555)
 
 data in those fields is
 id Description
 -- -----------
 1   aaa
 2   bbb
 3   ccc
 
 I want to read those values in my program.For that I opend recordset as follows
 
 Dim con As New ADODB.Connection
 Dim rs As New ADODB.Recordset

 con.Open "Provider=MSDASQL.1;Persist Security Info=False;User ID=test;Password=test;Data Source=vbi"
 rs.Open "select * from ProductClassification", con, 1, 2

If rs.EOF = True Then
    MsgBox "Failed"
Else

    Do While Not rs.EOF
     MsgBox rs.Filelds(0)  
     MsgBox rs.Filelds(1)
     rs.MoveNext
    Loop
End If



rs.Close
con.Close
Set rs = Nothing
Set con = Nothing


for description field it is showing correct values like aaa,bbb,ccc. but for id field it is showing 0 for all rows insted of actual values.
I tried
MsgBox rs("ID")
but it is showing same 0 instead of actual values

any suggetion,whether there is any problem in code or database
0
Comment
Question by:a_padwal
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 14

Expert Comment

by:ajexpert
ID: 7159279
Hi,
    say rs.fields(0).value instead of rs.fields  

    Do While Not rs.EOF
        MsgBox rs.Fields(0).value  
        MsgBox rs.Fields(1).value
        rs.MoveNext
    Loop
0
 
LVL 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 100 total points
ID: 7159294
ID NUMBER(38)

is the ID field actually NUMBER or NUMBER(38). This is the same for the size, but ADO has a problem with NUMBER. Try changing the ID to NUMBER(37) or NUMBER(38), which should help.

CHeers
0
 

Author Comment

by:a_padwal
ID: 7161289
thanks for answer it worked.
but other way also ,Priviously I was using "Provider=MSDASQL.1" for opening connection.But after using "Provider=MSDAORA.1" problem is solved.

0

Featured Post

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

737 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question