yaoleicara 发表于 2012-10-23 11:24:57

新手求助QTP操作oracle时表或视图不存在

Dim adoConn
Dim ConnectionStr
ConnectionStr ="Provider=MSDAORA.1;User ID=test;Password=test;Data Source=ORCL;Persist Security Info=False"
sqlStr = "select * from CORE_APP_DEPARTMENT"
Set adoConn = CreateObject("ADODB.Connection")
adoConn.Open ConnectionStr
if adoConn.state <> 0 Then
msgbox "数据库连接成功!"
Set adoRst = adoConn.Execute(sqlStr)
        For i=1 to adoRst.Fields.Count
    MsgBox adoRst.Fields.Item("DEPARTNAME").Value
   adoRst.MoveNext
   Next
   msgbox adoRst.Fields.Count
End If
adoConn.Close
SetadoConn = nothing
sql语句是从plsql里直接拷出来的,plsql里可以查询出数据
页: [1]
查看完整版本: 新手求助QTP操作oracle时表或视图不存在