TA的每日心情 | 开心 2015-8-13 10:14 |
---|
签到天数: 7 天 连续签到: 1 天 [LV.3]测试连长
|
3测试积点
如题目所说的,我的脚本如下:
Dim Sql_Connection,Sql_Command, Obj_Excel,Obj_EData
Sql_Connection="DSN=Excel Files;DBQ="&Environment.Value("TestDir")&"\..\cases\"&ExcelFile&".xlsx"
Sql_Command="Select * From ["&Sheetname&"$]"
Set Obj_Excel=CreateObject("ADODB.Connection")
Obj_Excel.Open Sql_Connection
Set Obj_EData=Obj_Excel.Execute(Sql_Command)
Obj_EData.MoveFirst
While Not Obj_EData.EOF
If Obj_EData.Fields("OperateType").Value = "AddEvent" and IsNumeric(Trim(Obj_EData.Fields("ShortCut").Value)) Then
Obj_EData.Fields("DataStatus").Value = "Pass"
End If
Obj_EData.Fields("DataStatus").Value = Empty
Obj_EData.MoveNext
Wend
ClearObject
运行QTP到Obj_EData.Fields("DataStatus").Value = "Pass"时会弹出提示框,如图所示,请问如何解决呢
|
最佳答案
查看完整内容
参见以下代码
Dim rst As ADODB.Recordset
Dim cnn As New ADODB.Connection
Set rst = New ADODB.Recordset
Set cnn = CurrentProject.Connection
rst.Open strsql, cnn, adOpenKeyset, adLockOptimistic
|