vb l连接oracle 采用ado 方式
情况说明:我电脑名称是pc181,ip:192.168.2.127我在我的电脑上装了ORACLEclient,oracle服务器名称为:cfnttestip为:192.1...
情况说明:
我电脑名称是pc181,ip:192.168.2.127
我在我的电脑上装了ORACLE client,
oracle 服务器名称为:cfnttest ip为:192.168.3.9
数据库名称为:cf_test
我能用的帐号是:cf3016,密码:cf3016
Set conn = New ADODB.Connection
Set rs = New ADODB.Recordset
' conn.ConnectionString = "provider=oraoledb.oracle;data source=czf_test;user id=cf3016;password=cf3016;" conn.ConnectionString = "driver={microsoft odbc for oracle};server=192.168.3.9;uid=cf3016;pwd=cf3016"
conn.ConnectionTimeout = 50
conn.Open
我想请教一下:上面的连接代码要怎么写,才能连接到oracle服务器上去?
如果可以,可以做一下介绍吗? 展开
我电脑名称是pc181,ip:192.168.2.127
我在我的电脑上装了ORACLE client,
oracle 服务器名称为:cfnttest ip为:192.168.3.9
数据库名称为:cf_test
我能用的帐号是:cf3016,密码:cf3016
Set conn = New ADODB.Connection
Set rs = New ADODB.Recordset
' conn.ConnectionString = "provider=oraoledb.oracle;data source=czf_test;user id=cf3016;password=cf3016;" conn.ConnectionString = "driver={microsoft odbc for oracle};server=192.168.3.9;uid=cf3016;pwd=cf3016"
conn.ConnectionTimeout = 50
conn.Open
我想请教一下:上面的连接代码要怎么写,才能连接到oracle服务器上去?
如果可以,可以做一下介绍吗? 展开
1个回答
展开全部
错了,最后一个;是不需要的
conn.ConnectionString = "provider=oraoledb.oracle;data source=czf_test;user id=cf3016;password=cf3016;"
错了,192.168.3.9改成数据库名称就对了
conn.ConnectionString = "driver={microsoft odbc for oracle};server=192.168.3.9;uid=cf3016;pwd=cf3016"
Dim con As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim constr, sqlstr As String
constr = "provider=oraoledb.oracle;data source=cf_test ;user id=cf3016;password=cf3016"
constr = "driver={microsoft odbc for oracle};server=cf_test ;uid=cf_test ;pwd=cf_test "
con.ConnectionString = constr
con.Open
sqlstr = "select * from TABLE where ..."
rs.Open sqlstr, constr, adOpenStatic, adLockReadOnly
conn.ConnectionString = "provider=oraoledb.oracle;data source=czf_test;user id=cf3016;password=cf3016;"
错了,192.168.3.9改成数据库名称就对了
conn.ConnectionString = "driver={microsoft odbc for oracle};server=192.168.3.9;uid=cf3016;pwd=cf3016"
Dim con As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim constr, sqlstr As String
constr = "provider=oraoledb.oracle;data source=cf_test ;user id=cf3016;password=cf3016"
constr = "driver={microsoft odbc for oracle};server=cf_test ;uid=cf_test ;pwd=cf_test "
con.ConnectionString = constr
con.Open
sqlstr = "select * from TABLE where ..."
rs.Open sqlstr, constr, adOpenStatic, adLockReadOnly
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询