Connecting Tech Pros Worldwide Forums | Help | Site Map

VB Oracle Connection Data Retrieval

Newbie
 
Join Date: Dec 2008
Posts: 1
#1: Dec 2 '08
I have a VB 6 application to connect to a Oracle database using ADO Connection. It works fine with Access. But when I try with my Oracle Database it does not retrieve any data. It can only show the Structure of the Tables. But no. of Rows is always 0. I have used Datagrid but only column names are displayed. Please help me. Its urgent for my exam also I m New to VB. The Connection Codes are given Below.

Option Explicit
Public conn As ADODB.Connection
Public rsUserAccount As ADODB.Recordset


Public Sub Connection()

'The Purpose of this function is to open a connection to link the database

Set conn = New ADODB.Connection

'conn.ConnectionString = "USER ID=scott;PASSWORD=tiger"
'conn.Provider = "MSDAORA.1"

conn.ConnectionString = "UID=scott;PWD=tiger;DRIVER={Microsoft ODBC for Oracle};" _
& "SERVER=Ora9iDBS;"


conn.Open

End Sub

Public Sub User_Account()

'The Purpose of this function is to open the recordset "User_Account"

Set rsUserAccount = New ADODB.Recordset

With rsUserAccount
.CursorType = adOpenDynamic
.LockType = adLockOptimistic
.ActiveConnection = conn
.Source = "Select * from UserAccount"
.CursorLocation = adUseClient
.Open
End With

End Sub

Thanks in advance. bye

debasisdas's Avatar
Moderator
 
Join Date: Dec 2006
Location: Bangalore ,India
Posts: 7,511
#2: Dec 2 '08

re: VB Oracle Connection Data Retrieval


Please change the name of the function . Connection is a predefined object of ADODB .
Reply

Tags
ado, connection, data retrieve, oracle, vb6.0


Similar Oracle Database bytes