|
本人菜鸟一个,目前正在自学QTP 在做数据库测试时遇到上述问题,请各位高手指点下,脚本代码如下
Const strConn="DRIVER={Microsoft Access Driver(*.mdb)};DBQ=C:\Program Files\Hp\QuickTest Professional\samples\flight\app\flight32.mdb"
Set objDB=CreateObject("ADODB.Connection")
objDB.ConnectionString=strConn
objDB.Open
sqlQuery="select o.*,f.Ticket_Price from orders o,flights f where o.flight_number=f.flight_number"
Set objResults=objDB.Execute(sqlQuery)
SumTickets=0
SumCustomers=0
SumMoney=0
objResults.MoveFirst
While Not objResults.EOF
SumTickets=SumTickets+objResults.Fields("Tickets_Ordered")
SumCustomers=SumCustomers+1
SumMoney=SumMoney+objResults.Fields("Tickets_Ordered")
objResults.MoveNext
Wend
Reporter.ReportEvent micPass,"Database 总票数","总票数="&SumTickets
reporter.ReportEvent micPass,"Database 顾客数","顾客数="&SumCustomers
reporter.ReportEvent micPass,"Database总价钱","总价钱="&SumMoney
objResults.Close
objDB.Close
Set objResults=Nothing
Set objDB=Nothing |
|