a_padwal
asked on
Problem in reading records of Oracle in VB
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;Persis t 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
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;Persis
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
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
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.
but other way also ,Priviously I was using "Provider=MSDASQL.1" for opening connection.But after using "Provider=MSDAORA.1" problem is solved.
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