DbTable对象

上一篇 / 下一篇  2007-05-14 17:09:35 / 个人分类:QTP学习

1.     DBTable对象的简介

在使用database检查点时,都必须用到DBTable对象。DBTable对象有三个方法(method):

Exist方法:

DbTable(descrīption).Exist([Timeout])

在应用程序中搜索DBTable对象,如果在Timeout时间范围内,还没有找到对象,则返回值False,表示在程序中没有找到该DBTable对象,否则返回值为True,表示在程序中找到了该DBTable对象。

GetTOProperty方法:

DbTable(descrīption).GetTOProperty(Property)

SetTOProperty方法:

DbTable(descrīption).SetTOPropertyProperty,Value

2.     示例:获取DBTable对象的Source属性值

下面的例子使用GetTOProperty方法来获取DBTable对象在修改前后的Source property

DbTable("DbTable").Check CheckPoint("DbTable")

IsExists = DbTable("DbTable").Exist (0)

If IsExists Then

       DimSQL

      SQL = DbTable("DbTable").GetTOProperty ("Source")

       MsgBox SQL

       DbTable("DbTable").SetTOProperty "Source", "SELECT * FROM ADDRESS"

       Dim NewSQL

       NewSQL = DbTable("DbTable").GetTOProperty("Source")

       MsgBox NewSQL

End If

3.     示例:设置DBTable对象的Source属性值

下面的例子使用SetToProperty方法,修改了DBTable对象的Source属性值,然后用GetToProperty方法获取并显示修改后的Source属性值。

DbTable("DbTable").Check CheckPoint("DbTable")

IsExists = DbTable("DbTable").Exist (0)

If IsExists Then

       DbTable("DbTable").SetTOProperty"Source", "SELECT * FROM ADDRESS"

       Dim NewSQL

       NewSQL = DbTable("DbTable").GetTOProperty("Source")

       MsgBox NewSQL

End If


TAG: QTP学习

 

评分:0

我来说两句

Open Toolbar