Home » Other » General » connect oracle through vb
icon5.gif  connect oracle through vb [message #121565] Mon, 30 May 2005 13:20 Go to next message
rashidzaib
Messages: 3
Registered: April 2005
Location: pakistan
Junior Member

hi
i am using vb and want to connect oracle database through vb.
pls help me
Re: connect oracle through vb [message #122036 is a reply to message #121565] Thu, 02 June 2005 08:54 Go to previous message
Penfold
Messages: 112
Registered: June 2005
Senior Member
Hi,

Here's two I'd use:-

OO4O (Oracle Objects for OLE)

Option Explicit

Dim m_oraSession As Object
Dim m_oraDatabase As Object

Private Sub Command1_Click()

    Set m_oraSession = CreateObject("OracleInProcServer.XOraSession")
    Set m_oraDatabase = m_oraSession.DBOpenDatabase("Database", "user/password", 0&)
    
    MsgBox "Connected to " & m_oraDatabase.Connect & "@" & m_oraDatabase.DatabaseName
    
End Sub

Private Sub Form_Unload(Cancel As Integer)

    Set m_oraDatabase = Nothing
    Set m_oraSession = Nothing
    
End Sub


ADO

Option Explicit

Public m_adoCnn As New ADODB.Connection
Public m_adoRst As New ADODB.Recordset

Public Sub Command1_Click()
    
    m_adoCnn.ConnectionString = "Provider=MSDAORA;Password=tiger;User ID=scott;Data Source=database"
    m_adoCnn.Open
    
End Sub

Private Sub Form_Unload(Cancel As Integer)

    m_adoCnn.Close
    
End Sub


Regards
Previous Topic: PLEASE help!!! the 1st record not displayed? in VB DataReport
Next Topic: What is alternet of cursor
Goto Forum:
  


Current Time: Mon Nov 04 20:04:38 CST 2024