标签:rds ide 添加组件 操作 添加 string cells .com uri
1.客户端必须安装对应oracle版本的client
2.excel中按如下操作添加组件
‘请先添加引用:工具-引用-Microsoft ActiveX Data Objects 2.8 ‘Library,Microsoft ActiveX Data Objects Recordset 2.8 Library
Sub OraLink() Dim conn As Object Dim rs As Object Dim strConn As String Set conn = CreateObject("ADODB.Connection") Set rs = CreateObject("ADODB.recordset") strConn = "Provider=OraOLEDB.Oracle.1; user id=joe; password=joe; data source = 192.168.0.118:2001/dbap.com.cn; Persist Security Info=True" conn.Open strConn ‘打开数据库 Set rs = conn.Execute("select * from joe.test") For j = 0 To rs.Fields.Count - 1 Cells(1, j + 1) = rs.Fields(j).Name Next ‘粘贴结果 Range("A2").CopyFromRecordset rs End Sub
标签:rds ide 添加组件 操作 添加 string cells .com uri
原文地址:https://www.cnblogs.com/joewancn/p/9652667.html