Vbscript VB脚本。需要在UFT工具中运行以下代码
我有下面的代码,外部数组没有将每个值与内部数组进行比较。外部数组与内部的一个值进行比较,并移动到其中的下一个值Vbscript VB脚本。需要在UFT工具中运行以下代码,vbscript,hp-uft,Vbscript,Hp Uft,我有下面的代码,外部数组没有将每个值与内部数组进行比较。外部数组与内部的一个值进行比较,并移动到其中的下一个值 testdata = {25,27,81,104,33,34,56,78,99,84} testdata1 = {81,104} For i = 0 To UBound(testdata) - 1 For j = 0 To UBound(testdata1) - 1 If testdata(i) = testdata1(j) Then isFound = Tr
testdata = {25,27,81,104,33,34,56,78,99,84}
testdata1 = {81,104}
For i = 0 To UBound(testdata) - 1
For j = 0 To UBound(testdata1) - 1
If testdata(i) = testdata1(j) Then
isFound = True
Call DB_Connectionwisdataflagupdation(sQuery,Para2,Para3,Para4,sValue)
'c=c+1
Exit for
End If
'isFound = True
isFound = False
Next
Next
请帮我找到这方面的解决方案。我对您的代码做了一些小改动,主要是调整For循环上的索引:
Dim i As Integer
Dim j As Integer
Dim isFound As Boolean
For i = LBound(testdata) To UBound(testdata)
For j = LBound(testdata1) To UBound(testdata1)
If testdata(i) = testdata1(j) Then
isFound = True
'Call DB_Connectionwisdataflagupdation(sQuery, Para2, Para3, Para4, sValue)
MsgBox testdata(i)
Exit For
End If
isFound = False
Next
Next
为什么你要从ubound(arr)中减去1?只要运行循环到ubound(arr)就可以了。