HP Quality Center从数据库检索数据

时间:2015-07-21 12:22:21

标签: vbscript qc hp-quality-center

我使用脚本编辑器在QC服务器上运行了几个vb脚本。 我使用的是QC 12,我有一个使用QC api建立连接的函数,获取一些数据然后将这个数据递增1,事实是它从数据库中得到一个空值。 这是功能:

Function SW_KeepTIDLastValue()
On Error Resume Next
  Dim tdc, val
  Dim cset
  Dim bld
  On Error Resume Next
  bld = ""
  Set tdc = TDConnection     'Open a connection using the QC API
  Set tdc =  CreateObject("TDApiOle80.TDConnection")
  Set cset = tdc.CommonSettings
  'Set cset = tdc.COMMON_SETTINGS
    cset.Open ("KeepTIDValueSetting")
    val = cset.Value("KeepTIDValueField")   'Retrieve the value stored in the DB
   ' val = CDbl(cset.Value("KeepTIDValueField"))
    msgbox(TypeName(val) & " " & val)
    SW_KeepTIDLastValue = val+1             'Increment the value by 1
    msgbox(TypeName(val) & " " & SW_KeepTIDLastValue )
    cset.Value("KeepTIDValueField") = val+1 'Store the value back in the DB
    cset.Close

If Err.Number <> 0 Then
  SW_DisplayError Err.Number, Err.Description, "Keep Last Value (" & action & ")"
End If

On Error GoTo 0

End Function

0 个答案:

没有答案