QTP 连接mysql数据库

上一篇 / 下一篇  2008-12-31 15:33:49 / 个人分类:点滴学习。。。

      Dim Cnn, Rst, strCnn
strCnn = "DRIVER={MySQL ODBC 3.51 Driver};SERVER=192.168.128.28;DATABASE=test_v1;USER=root;PWD=root;Option=3"
Set Conn = CreateObject("ADODB.Connection")
Set Rs = CreateObject("ADODB.Recordset")
Conn.Open strCnn
If Conn.State = 0 Then
    Reporter.ReportEvent micFail, "testing data-bse", "连接数据库失败"
else
   Reporter.ReportEvent micPass, "testing data-bse",   "连接数据库成功"
end if
 sql ="select address.ad_name from mytable...where iata.iata_name='"+out_iata+"' and ... group by address.depot_id limit 0,1"
  Rs.open sql,Conn,1,1
Dim depot
         Do while not rs.eof
        depot = rs("ad_name")
         If "out_depot"= rs("ad_name") Then
                Reporter.ReportEvent 1, "查询out_depot失败" , "查询结果是   "&depot
             Exit do
           else
                Reporter.ReportEvent 0, "查询out_depot成功", "查询结果是   "&depot
           End If
          rs.movenext
         Loop
rs.close
conn.close
set conn=nothing

TAG: QTP 连接mysql数据库

 

评分:0

我来说两句

我的栏目

日历

« 2024-04-30  
 123456
78910111213
14151617181920
21222324252627
282930    

我的存档

数据统计

  • 访问量: 2052
  • 日志数: 4
  • 建立时间: 2008-12-26
  • 更新时间: 2008-12-31

RSS订阅

Open Toolbar