ADOConnection Property

Applies to TestComplete 15.47, last modified on January 20, 2023

Description

Use this property to obtain the ADO Connection object, which the ADODriverObj driver uses to work with a recordset holding the desired data.

Declaration

ADODriverObj.ADOConnection

Read-Only Property An ADO Command object
ADODriverObj An expression, variable or parameter that specifies a reference to an ADODriver object

Applies To

The property is applied to the following object:

Property Value

The ADO Connection object used by ADODriverObj.

Example

The code below connects to the specified database, performs some actions over the database's records and then closes the connection by using the ADOConnection property.

Notes:

JavaScript, JScript

function ADOConnectionDemo()
{
  // Specifies the connection string
  var ConStr = "Provider=Microsoft.Jet.OLEDB.4.0;" +
  "Data Source=C:\\Users\\Public\\Documents\\TestComplete 15 Samples\\Desktop\\Checkpoints\\XML\\DataGridViewSample\\OrdersDB.mdb";
  // Specifies the name of the table
  var tName = "orders";
  
  // Performs some actions over the table records
  
  // Closes the connection to the specified database
  DDT.ADODriver(ConStr, tName).ADOConnectionObject.Close();
}

Python

def ADOConnectionDemo():
  # 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"
  # Performs some actions over the table records
  # Closes the connection to the specified database
  DDT.ADODriver(ConStr, tName).ADOConnectionObject.Close()

VBScript

Sub ADOConnectionDemo

  ' Specifies the connection string
  ConStr = "Provider=Microsoft.Jet.OLEDB.4.0;" + _
  "Data Source=C:\Users\Public\Documents\TestComplete 15 Samples\Desktop\Checkpoints\XML\DataGridViewSample\OrdersDB.mdb"
  ' Specifies the name of the table
  tName = "orders"
  
  ' Performs some actions over the table records
  
  ' Closes the connection to the specified database
  Call DDT.ADODriver(ConStr, tName).ADOConnectionObject.Close
  
End Sub

DelphiScript

function ADOConnectionDemo;
var ConStr, tName;
begin
  // Specifies the connection string
  ConStr := 'Provider=Microsoft.Jet.OLEDB.4.0;' +
  'Data Source=C:\Users\Public\Documents\TestComplete 15 Samples\Desktop\Checkpoints\XML\DataGridViewSample\OrdersDB.mdb';
  // Specifies the name of the table
  tName := 'orders';
  
  // Performs some actions over the table records
  
  // Closes the connection to the specified database
  DDT.ADODriver(ConStr, tName).ADOConnectionObject.Close();
end;

C++Script, C#Script

function ADOConnectionDemo()
{
  // Specifies the connection string
  var ConStr = "Provider=Microsoft.Jet.OLEDB.4.0;" +
  "Data Source=C:\\Users\\Public\\Documents\\TestComplete 15 Samples\\Desktop\\Checkpoints\\XML\\DataGridViewSample\\OrdersDB.mdb";
  // Specifies the name of the table
  var tName = "orders";
  
  // Performs some actions over the table records
  
  // Closes the connection to the specified database
  DDT["ADODriver"]( ConStr, tName )["ADOConnectionObject"]["Close"]();
}

See Also

ADOCommand Property

Highlight search results