Connection string syntax for Classic ADO / ODBC / Oracle 10g EZConnect

后端 未结 3 2015
别跟我提以往
别跟我提以往 2021-01-04 18:31

I\'m trying to connect various VBA projects to an Oracle 10g back end using ADO (2.8) and no TNS. After various attempts, we\'ve decided that the simplest series of steps fo

3条回答
  •  星月不相逢
    2021-01-04 19:14

    ' Create a connection object.'
    Dim cn As ADODB.Connection
    Set cn = New ADODB.Connection
    
    ' Create a recordset object.'
    Dim rs As ADODB.Recordset
    Set rs = New ADODB.Recordset
    
    ' Provide the connection string.'
    Dim strConn As String
    Dim str As String
    
    'Use the SQL Server OLE DB Provider.'
    strConn = "Driver=(Oracle in OraHome92);" & "Data Source=;Uid=;Pwd=;"
    
    'Now open the connection.'
    cn.Open strConn
    With rs
    
        ' Assign the Connection object.'
        ActiveConnection = cn
    
        ' Extract the required records.'
        .Open "SELECT ", cn
    
    
    End With
    

提交回复
热议问题