DBTable Object

Applies to TestComplete 15.48, last modified on March 01, 2023

Description

The DBTable object provides scripting access to elements in the DBTables collection of the Stores project item. Using the object’s properties and methods you can access the stored values and compare the stored data against the contents of a database table, view or query.

To obtain the DBTable object in scripts, use properties of the DBTables object.

Requirements

The DBTable object is available only if your project contains the Stores project item with the DBTables collection in it.

Members

Example

The code below demonstrates how you can use the DBTable object to compare a stored table with the actual one (the table that was used to create the specified DB Table element).

JavaScript, JScript

function DBTableObject()
{
  // Compares a stored table with the actual table
  var Res = DBTables.DBTable1.Check();
  
  // Checks the comparison result
  if (Res)
    Log.Message("The tables are equal.")
  else
    Log.Error("The tables are different.");
    
}

Python

def DBTableObject():
  # Compares a stored table with the actual table
  Res = DBTables.DBTable1.Check()
  # Checks the comparison result
  if Res:
     Log.Message("The tables are equal.")
  else:
     Log.Error("The tables are different.")

VBScript

Sub DBTableObject

  ' Compares a stored table with the actual table
  Res = DBTables.DBTable1.Check
  
  ' Checks the comparison result
  If Res Then
    Log.Message("The tables are equal.")
  Else
    Log.Error("The tables are different.")
  End If
    
End Sub

DelphiScript

function DBTableObject();
var Res;
begin

  // Compares a stored table with the actual table
  Res := DBTables.DBTable1.Check;
  
  // Checks the comparison result
  if Res then
    Log.Message('The tables are equal.')
  else
    Log.Error('The tables are different.');
    
end;

C++Script, C#Script

function DBTableObject()
{
  // Compares a stored table with the actual table
  var Res = DBTables["DBTable1"]["Check"]();
  
  // Checks the comparison result
  if (Res)
    Log["Message"]("The tables are equal.")
  else
    Log["Error"]("The tables are different.");
    
}

See Also

DBTables Object
About Database Checkpoints

Highlight search results