ADODriver Object

Applies to TestComplete 14.0, last modified on January 23, 2019

Description

The ADODriver object is a DDT driver object that provides access to data stored in a recordset that can be accessed via ADO DB. The recordset can be a database table or a result of executing the SELECT SQL statement.

To obtain the ADODriver objects in scripts, call the ADODriver method of the DDT object.

Members

Example

The ADODriverExample procedure connects to the specified database, retrieves information about the text of the command used by the database’s table, posts this command text to the test log, and then closes the connection to the database.

Notes:

JavaScript, JScript

function ADODriverExample()
{
 // Specifies the connection string
  var ConStr = "Provider=Microsoft.Jet.OLEDB.4.0;" +
  "Data Source=C:\\Users\\Public\\Documents\\TestComplete 14 Samples\\Desktop\\Checkpoints\\XML\\DataGridViewSample\\OrdersDB.mdb";
  // Specifies the name of the table
  var tName = "orders";
  // Obtains the ADO Command text
  var cText = DDT.ADODriver(ConStr, tName).ADOCommandObject.CommandText;
  // Posts this command text to the test log
  Log.Message(cText);
  // Closes the connection to the specified database
  DDT.ADODriver(ConStr, cText).ADOConnectionObject.Close();
}

Python

def ADODriverExample():
  # Specifies the connection string
  ConStr = "Provider=Microsoft.Jet.OLEDB.4.0;" + \
  "Data Source=C:\\Users\\Public\\Documents\\TestComplete 14 Samples\\Desktop\\Checkpoints\\XML\\DataGridViewSample\\OrdersDB.mdb"
  # Specifies the name of the table
  tName = "orders"
  # Obtains the ADO Command text
  cText = DDT.ADODriver(ConStr, tName).ADOCommandObject.CommandText
  # Posts this command text to the test log
  Log.Message(cText)
  # Closes the connection to the specified database
  DDT.ADODriver(ConStr, cText).ADOConnectionObject.Close()

VBScript

Sub ADODriverExample
   ' Specifies the connection string
  ConStr = "Provider=Microsoft.Jet.OLEDB.4.0;" + _
  "Data Source=C:\Users\Public\Documents\TestComplete 14 Samples\Desktop\Checkpoints\XML\DataGridViewSample\OrdersDB.mdb"
  ' Specifies the name of the table
  tName = "orders"
  ' Obtains the ADO Command text
  cText = DDT.ADODriver(ConStr, tName).ADOCommandObject.CommandText
  ' Posts this command text to the test log
  Log.Message(cText)
  ' Closes the connection to the specified database
  DDT.ADODriver(ConStr, tText).ADOConnectionObject.Close
End Sub

DelphiScript

function ADODriverExample;
var ConStr, tName, cText;
begin
  // Specifies the connection string
  ConStr := 'Provider=Microsoft.Jet.OLEDB.4.0;' +
  'Data Source=C:\Users\Public\Documents\TestComplete 14 Samples\Desktop\Checkpoints\XML\DataGridViewSample\OrdersDB.mdb';
  // Specifies the name of the table
  tName := 'orders';
  // Obtains the ADO Command text
  cText := DDT.ADODriver(ConStr, tName).ADOCommandObject.CommandText;
  // Posts this command text to the test log
  Log.Message(cText);
  // Closes the connection to the specified database
  DDT.ADODriver(ConStr, cText).ADOConnectionObject.Close();
end;

C++Script, C#Script

function ADODriverExample()
{
  // Specifies the connection string
  var ConStr = "Provider=Microsoft.Jet.OLEDB.4.0;" +
  "Data Source=C:\\Users\\Public\\Documents\\TestComplete 14 Samples\\Desktop\\Checkpoints\\XML\\DataGridViewSample\\OrdersDB.mdb";
  // Specifies the name of the table
  var tName = "orders";
  // Obtains the ADO Command text
  var cText = DDT["ADODriver"]( ConStr, tName )["ADOCommandObject"]["CommandText"];
  // Posts this command text to the test log
  Log["Message"](cText);
  // Closes the connection to the specified database
  DDT["ADODriver"](ConStr, cText)["ADOConnectionObject"]["Close"]();
}

See Also

Using DDT Drivers
Data-Driven Testing - Basic Concepts
Data-Driven Testing - Retrieving Input Data From Storage
DDT Object
DDTDriver Object

Highlight search results