|
我在网上找到一个简单的使用datapool的例子,但是运行不起来,有好几个地方编译通不过,其中,“dp=SQADatapoolOpen("jsq");”一行,我Dim了新的变量,该行的编译错误已经改掉了,但是 Result = LabelVP (CompareNumeric, "Text="& sum &".","VP=Alphanumeric;Value="& sum &"."); 始终是不对,也不知道应该怎么改,求助哪位帮我看看,应该怎么改,谢谢。
例子脚本如下:
------------------------------------------------------------------------------------------------------------------------
Sub Main
Dim Result As Integer
'Dim定义一个变量
Dim x as integer
Dim num1 as string
Dim num2 as string
Dim sum as string
'Initially Recorded: 2003-7-18 8:51:18
'Script Name: 计算器-2
StartApplication "C:\WINNT\system32\calc.exe"
dp=SQADatapoolOpen("jsq");
'打开数据池,jsp为数据池的名称,这个数据池是预先按照上述规范做好的
for x=1 to 5
Call SQADatapoolFetch(dp)
'从数据池中读取记录
Call SQADatapoolValue(dp, 1, num1)
Call SQADatapoolValue(dp, 2, num2)
Call SQADatapoolValue(dp, 3, sum)
'将从数据池中读取的数据赋予相应变量
Window SetContext, "Caption=计算器", ""
InputKeys num1 & "{+}" & num2 & "{ENTER}"
Result = LabelVP (CompareNumeric, "Text="& sum &".","VP=Alphanumeric;Value="& sum &".");
'LabelVP是为标签控制建立查证点,Result = LabelVP (action%, recMethod$, parameters$)
next
Call SQADatapoolClose(dp)
'关闭数据池
Window CloseWin, "", ""
End Sub
-------------------------------------------------------------------------------- |
|