Archive for 3月 5th, 2013

  1. Hello, oo4o(VB6) World!

    Posted on 3月 5th, 2013 by cx20

    oo4o

    oo4o(Oracle Objects for OLE)は、COM ベースの Oracle Database 接続用 API である。
    Windows 環境で VB による開発に用いられることが多い。

    ソースコード(VB6 + oo4o + Oracle)

    Option Explicit
     
    Sub Main()
        Dim ses
        Dim db
        Dim rs
        Set ses = CreateObject("OracleInProcServer.XOraSession")
        Set db = ses.OpenDatabase( "ORCL", "scott/tiger", 0 )
        Set rs = db.CreateDynaset( "SELECT 'Hello, oo4o World!' AS Message FROM DUAL", 4)
        While NOT rs.EOF
            Debug.Print rs(0).Name
            Debug.Print "------------------"
            Debug.Print rs(0).Value
            rs.MoveNext
       Wend
    End Sub

    コンパイル方法

    C:¥> vb6 /make hello.vbp

    実行結果

    MESSAGE
    ------------------
    Hello, oo4o World!