51Testing软件测试论坛

标题: 新手求助QTP操作oracle时表或视图不存在 [打印本页]

作者: yaoleicara    时间: 2012-10-23 11:24
标题: 新手求助QTP操作oracle时表或视图不存在
  1. Dim adoConn
  2. Dim ConnectionStr
  3. ConnectionStr ="Provider=MSDAORA.1;User ID=test;Password=test;Data Source=ORCL;Persist Security Info=False"
  4. sqlStr = "select * from CORE_APP_DEPARTMENT"
  5. Set adoConn = CreateObject("ADODB.Connection")
  6. adoConn.Open ConnectionStr
  7. if adoConn.state <> 0 Then
  8. msgbox "数据库连接成功!"
  9. Set adoRst = adoConn.Execute(sqlStr)
  10.         For i=1 to adoRst.Fields.Count
  11.     MsgBox adoRst.Fields.Item("DEPARTNAME").Value
  12.    adoRst.MoveNext
  13.    Next
  14.    msgbox adoRst.Fields.Count
  15. End If
  16. adoConn.Close
  17. Set  adoConn = nothing
复制代码
sql语句是从plsql里直接拷出来的,plsql里可以查询出数据




欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/) Powered by Discuz! X3.2