Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Newbie: ODBC & VB & ORACLE

Re: Newbie: ODBC & VB & ORACLE

From: <rengland_at_apci.net>
Date: 1997/09/26
Message-ID: <875292993.13348@dejanews.com>#1/1

In article <34279058.81693164_at_news.xs4all.nl>,   Oosterling_at_compuserve.com wrote:
>
> Hello there,
>
> I got a question. I want to write a VB program using oracle. I believe
> that i need to use ODBC. But what do i have to do to make this work ?
>
> BTW
>
> i don't know nothing about ODBC !

Below is a sample VB procedure that makes a connection to an Oracle database. Note: I am a DBA and not a VB programmer; however, this should give you anidea. All variables are STRING except the daoDB, which is a database variable. Also, I use DAO access in this example and VB 4.0.

Private Sub connectDAO_Click()

  DSN = "your_dsn"
  UID = "your_oracle_user_id"
  PWD = "your_oracle_password"

  dbConnect = "DSN=" & DSN & ";UID=" & UID & ";PWD=" & PWD   dbName = ""

  On Error Resume Next
  Form1.MousePointer = 11
  Set daoDB = OpenDatabase(dbName, _

                           False, _
                           False, _
                           dbConnect)

  If Err.Number <> 0 Then

    Call MsgBox("ERROR NUMBER:  " & Err.Number & Chr(13) & Chr(13) & _
                "DESCRIPTION:  " & Err.Description & Chr(13) & Chr(13) & _
                "SOURCE:  " & Err.Source & Chr(13), _
                vbCritical + vbOKOnly, _
                "Oracle Database Error")
  End If
  Form1.MousePointer = 0

End Sub

Hope this helps. Please feel free to email me if you still have questions.

Bob England
GTE Government Systems
rengland_at_apci.net
rengland_at_fvh.gtegsc.com

-------------------==== Posted via Deja News ====-----------------------
      http://www.dejanews.com/     Search, Read, Post to Usenet
Received on Fri Sep 26 1997 - 00:00:00 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US