QTP用ADO连接Excel表更新表中数据出错
本帖最后由 arvin45 于 2015-7-22 17:25 编辑如题目所说的,我的脚本如下:
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=CreateObject("ADODB.Recordset")
Obj_EData.Open Sql_Command, Obj_Excel, 2, 2
Obj_EData.MoveFirst
While Not Obj_EData.EOF
If Obj_EData.Fields("OperateType").Value = "AddEvent" Then
Obj_EData.Fields("Status").Value = "Running"
Obj_EData.Update
End If
Obj_EData.MoveNext
Wend
ClearObject
运行QTP会弹出提示框,如图所示,请问如何解决呢
页:
[1]