dolice218 发表于 2010-11-23 15:17:58

创建不了数据库连接对象

Dim Cnn, Rst, i
Set Cnn = createobject ("ODBC.connection")
用论坛上创建对象的方法试了下,运行时抱错说无法创建,我想创建一个连接对象用来连接数据库,该怎样做呢?

dreamever 发表于 2010-11-23 15:20:31

http://wenku.baidu.com/view/2b3941fff705cc17552709ed.html
里面详细的代码

TIB 发表于 2010-11-25 16:30:10


Dim rs,sq,pkey
set conn=createobject("adodb.connection")
set rs=createobject("adodb.recordset")

' 需要安装Oracle客户端
conn.open "Provider=OraOLEDB.Oracle.1;Persist Security Info=False;User ID=scott;Data Source=orcl;Password=orcl;Extended Properties=;Host=192.168.1.188;Port=1521;Service Name=orcl;"

sql="SELECT * FROM TAB"
rs.open sql,conn
rs.MoveFirst
Do While rs.Eof<>true
Msgbox rs.Fields(0)
rs.MoveNext
Loop
rs.close
set rs=nothing
conn.close
set conn=nothing
页: [1]
查看完整版本: 创建不了数据库连接对象