DBA ORACLE連線操作

小虎發表於2020-10-26

Sub TEST_Click()

 

    MsgBox "hello"

    Dim cnn As ADODB.Connection

   Dim rs As ADODB.Recordset

    Set cnn = CreateObject("ADODB.Connection")

 

   --選擇一個

    cnn.Open "Provider=OraOLEDB.Oracle.1;Data Source=127.0.0.1/ORCL;User Id=aaa;Password=aaa;"

    cnn.Open "Provider=MSDAORA.1; Data Source=DefineORCL;User Id=aaa;Password=aaa;"    

   

   Set rs= dbConn.Execute("select * from aaa")    

 

    For j = 0 To rs.Fields.COUNT - 1

      Cells(1, j + 1) = rs.Fields(j).Name

    Next

 

End Sub

相關文章