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 oracle9i to vb6 by odbc? plese 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: 1  Reply

 
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.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

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.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

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

Following