Dim strconnt As String
Set connt = New ADODB.Connection
Dim rs As Object
Set rs = New ADODB.Recordset
Dim sevip, Db, user, pwd As String
'设服务器地址、所连数据,及登录用户密码
sevip = "****"
Db = "****"
user = "****"
pwd = "****"
strconnt = "DRIVER={Microsoft ODBC for Oracle}Password=appsUser ID=appsData Source=demo" '
connt.ConnectionString = strconnt
connt.Open
End Sub
Dim strSql As StringstrSql = "DRIVER={Microsoft ODBC for Oracle}UID="
strSql = strSql &[user].Value &"PWD="
strSql = strSql &[Password].Value &"SERVER=(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST="
strSql = strSql &[ip].Value
strSql = strSql &")(PORT="
strSql = strSql &[port].Value
strSql = strSql &"))(CONNECT_DATA=(SID="
strSql = strSql &[sid].Value
strSql = strSql &")))"
将中括号中的内容通过设定名称指定对应单元格即可。另外,一定得安装好ORACLE客户端才行。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)