Re: ODBC Examples

From: Luis Cabral <cabral_at_merconet.com.br>
Date: 1997/12/24
Message-ID: <01bd0fdd$4c833c20$LocalHost_at_lcdc>#1/1


Hi Terry,

I do not work a lot with VB, but once I had to write a little program, and it worked great.

I simply created a data source for my 7.3 Oracle database using ODBC 32 bits, called PAN, and coded as below (a little piece of the code), using VB 4.0:

    dim rs as recordset

    gsDataBase = "PAN"
    gsConnectOptions = "DSN=PAN;UID=PAN;PWD=P;"    

    lblStatus.Caption = "Conectando ao banco de dados..."     Me.Refresh
    Set gdb = OpenDatabase(gsDataBase, False, False, gsConnectOptions)     lblStatus.Caption = "Pesquisando entidade..."     Me.Refresh
    Set rs = gdb.OpenRecordset("select nm_entidade from tab_entidade_consulta where ca_entidade = '" + gsEntidade + "'", dbOpenSnapshot, dbSQLPassThrough + dbForwardOnly)

    If rs.EOF Then

        lblStatus.Caption = "Entidade inválida (" + gsEntidade + ")"
        Exit Sub

    End If
    ...

Hope it helps, and feliz Natal!

-- 
Luis Cabral
cabral_at_merconet.com.br


Terry Arnett <terrya_at_texmicro.com> escreveu no artigo
<01bd0fca$90809c00$db895fcc_at_ranger.texmicro.com>...

> can anybody share their secrets when it comes to writing Visual Basic
code,
> using ODBC to connect to Oracle? I would like to bypass the need to
attach
> to an ACCESS database, and apply SQL directly to the database. Can this
be
> done?
>
> Any help would be appreciated!
>
> Terry
>
Received on Wed Dec 24 1997 - 00:00:00 CET

Original text of this message