|
Const strconn = "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=D:\QTPWorking\samples\flight\app\flight32.mdb"
Set objDB = createObject("ADODB.connection")
objDB.ConnectionString= strconn
objDB.Open
Dialog("Login").WinButton("Cancel").Click
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.Fields("Ticket_Price")
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
执行到第四句时提示未发现数据源名称并且未指定默认驱动程序,请问我应该怎么解决 |
|