How to connect Oracle 9i to Visual Basic by ODBC?

5 pts.
Tags:
Database connectivity
ODBC
Oracle 9i
Oracle connectivity
Visual Basic 6
How to connect Oracle 9i to VB6 by ODBC? Please provide me code also?

Answer Wiki

Thanks. We'll let you know when a new response is added.

Here’s an example of a connection to an Oracle 10g Express Edition instance, but there should be no difference if you use it to connect to a 9i database.

The oracle client software needs to be installed, and in this case ‘XE’ is the database alias defined in the tnsnames.ora file.

<pre>Private Sub Form_Load()

Dim C As New ADODB.Connection
C.Open “Driver={Microsoft ODBC for Oracle};Server=xe; Uid=yourUserName;Pwd=YourPassword;”

Dim Rec As New ADODB.Recordset
Dim SQL As String
SQL = “SELECT column_x from YourTable where column_y = 1”
Rec.Open SQL, C, adOpenForwardOnly, adLockReadOnly
Do Until Rec.EOF

Me.txtColor.Text = Rec.Fields(“column_x”).Value
Rec.MoveNext

Loop
Rec.Close
Set Rec = Nothing

C.Close

End Sub</pre>

Hope this helps.

Discuss This Question: 4  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.
  • iamhungryforknowledge
    how to connect oracle by vb

    10 pointsBadges:
    report
  • klm222
    I have problem with my access program. When I copy the program to another computer and open it, I received message said that he didn't find hdsnbts.dll version 1.0. What can I do?
    10 pointsBadges:
    report
  • Subhendu Sen
    @klm222, what did you mean by copy access program? Have you tried to install MS Access on your system? If yes, it is almost impossible to run access just copied the program. You have to run the setup of MS Office software either from CD/DVD or from USB with proper license.
    93,560 pointsBadges:
    report
  • carlosdl
    klm222: You should create a new question. Your problem is unrelated to this one.
    84,355 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.

Following

Share this item with your network: