How to output MySQL value to your data table
上一篇 /
下一篇 2006-12-22 02:33:24
/ 个人分类:QTP
When we test our applications, we may want to check how the application performs the same operations with multiple sets of data. In general we use different set of data from data table to parameter test. So, here is the way how to select data from MySQL database and insert to data table.
**************************************************************************************************
SetConn= CreateObject("ADODB.Connection" )
'Set cmd = CreateObject("adodb.command")
str="DRIVER={MySQL ODBC 3.51 Driver};SERVER=webdev;DATABASE=intranet;user id=root; password=xxxxxx"
Conn.open str
Set Rs = CreateObject ("ADODB.Recordset" )
sql = "select * from `user` limit 1;"
Rs.open sql,conn,1,3
While Not Rs.eof
For i=1 to 6
'********** write to data table
DataTable("Intranet_user"&i,"Global") = Rs(i)
next
Rs.movenext
DataTable.Export ("C:\user.xls")
wend
Rs.close
Set Rs = Nothing
Conn.close
SetConn= Nothing
***************************************************************************************
相关阅读:
- 数据驱动在QTP的运用 (xiaonan, 2006-12-12)
- QTP中几个截取字符串的函数 (风过无息, 2006-12-14)
- Action级别的参数调用 (风过无息, 2006-12-14)
- Action的输入输出参数问题 (ccc11yyy, 2006-12-15)
- QTP中的测试对象和运行时对象 (xiaonan, 2006-12-15)
- 抛砖引玉:QTP处理定时运行程序的办法 (风过无息, 2006-12-18)
- QTP中测试环境的初始化 (xiaonan, 2006-12-19)
- QTP Recovery Scenario 简介 (ccc11yyy, 2006-12-19)
- QTP脚本还可以这样写 (ccc11yyy, 2006-12-21)
- How to parameter instance in QTP by using describing program (joshfang, 2006-12-22)
收藏
举报
TAG:
QTP