|
For Rrow = 2 to EXCELrow + 1
msgbox xlSheet.cells(2,2)
CString = "DRIVER=SQL Server;SERVER=XIONGRQ\SQL2005;UID=saWD=Xiongruiqi123;APP=2007 Microsoft Office system;WSID=XIONGRQ;DATABASE=0623-QTP"
SeString = xlSheet.cells(Rrow,2)
set bbb = databaseFunction(CString,SeString)
ContractCode = bbb(0)
Browser("XXX").Page("XXX").Frame("ifrmGrid_2").WebElement("innertext:="&ContractCode,"html tag:=NOBR").Click
Browser("XXX").Page("XXX").Frame("Frame").Image("mnuDown").Click
Page("age").WebElement("mnu_rArrow").Click'点击删除
Message = Browser("xxx").Dialog("Microsoft Internet Explorer").Static("xxx!").GetROProperty("text")
If Message = xlSheet.cells(Rrow,1) Then
Reporter.ReportEvent 0,Message+"校验","通过(不能删除)"
Browser("xxx").Dialog("Microsoft Internet Explorer").WinButton("确定").Click
else
Reporter.ReportEvent 1,Message+"校验","失败(应该不能删除)"
End If
Rrow = Rrow +1
Next
CloseExcel(XL)
function databaseFunction(ConnectString,SelectString)
Dim cmd,sql,Res
Set Res = Createobject("adodb.recordset")
Set Cmd = Createobject("adodb.command")
Cmd.activeconnection = ConnectString
Cmd.commandtype = 1
Cmd.commandtext = SelectString
Set Res = Cmd.Execute() 第二次运行的时候在这里报错
Set databaseFunction = Res
Set Res = nothing
Set Cmd.activeconnection = nothing
Set Cmd = nothing
end function
Function OpenExcel(BooksName,SheetName,XlApp)
'Stracfile = PathFinder.Locate(BooksName)
Set XlApp = CreateObject("Excel.Application")
Set XlBook = XlApp.WorkBooks.Open(BooksName)
Set xlSheet = XLbook.Worksheets(SheetName)
xlApp.Visible = False
set OpenExcel = xlSheet
End Function
Function CloseExcel(XlApp)
XlApp.Activeworkbook.save
XlApp.Quit
Set XlBook = Nothing
Set XlApp = Nothing
End Function |
|