Description
Creates a new IAQAADOTable object and returns a reference to it.
Declaration
ADO.CreateADOTable()
| Result | An IAQAADOTable object |
|||
Applies To
The method is applied to the following object:
Result Value
An object of the IAQAADOTable type.
Remarks
The IAQAADOTable object is an analogue of a Borland VCL TADOTable object. Methods and properties are identical.
For detailed information on the underlying TADOTable object, see VCL documentation on ADODB classes.
Once the IAQAADOTable object is created, you can use it to navigate through the table and to add, delete or modify records in it. To do this, you must first:
- Establish a connection to the database (set the
ConnectionorConnectionStringproperty). - Specify the table name (set the
TableNameproperty). - Open the table using the
Openmethod or theActiveproperty.
Example
The following code illustrates how you can use the IAQAADOTable object in your scripts. This example uses the Biblio.mdb file shipped with Microsoft Visual Basic. The TestProc routine processes the first ten records of the Authors table
and posts data into the test log.
| Note: |
Using the Microsoft.Jet.OLEDB.4.0 provider requires that you run your script in the 32-bit version of TestComplete. TestComplete 32-bit executable is located in the <TestComplete>\Bin folder. |
JavaScript, JScript
{
var Tbl, i;
// Create an IAQAADOTable object
Tbl = ADO.CreateADOTable();
// Specify the connection string
Tbl.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;"+
"Data Source=C:\\Microsoft Visual Studio\\VB98\\biblio.mdb";
// Specify the table name
Tbl.TableName = "Authors";
// Open the table
Tbl.Open();
// Process the first ten records and post data to the test log
Tbl.First();
for (i = 0; i < 10; i++)
{
Log.Message(Tbl.FieldByName("Author").Value, Tbl.FieldByName("Year Born").Value);
Tbl.Next();
}
Tbl.Close();
}
Python
def TestProc():
# Create an IAQAADOTable object
Tbl = ADO.CreateADOTable()
# Specify the connection string
Tbl.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" + "Data Source=C:\\Microsoft Visual Studio\\VB98\\biblio.mdb"
# Specify the table name
Tbl.TableName = "Authors"
# Open the table
Tbl.Open()
# Process the first ten records and post data to the test log
Tbl.First()
for i in range(0, 10):
Log.Message(Tbl.FieldByName("Author").Value, Tbl.FieldByName("Year Born").Value)
Tbl.Next()
Tbl.Close()
VBScript
' Create an IAQAADOTable object
Set Tbl = ADO.CreateADOTable
' Specify the connection string
Tbl.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;"+_
"Data Source=C:\Microsoft Visual Studio\VB98\biblio.mdb"
' Specify the table name
Tbl.TableName = "Authors"
' Open the table
Tbl.Open
' Process the first ten records and post data to the test log
Tbl.First
For i = 0 To 9
Log.Message Tbl.FieldByName("Author").Value, Tbl.FieldByName("Year Born").Value
Tbl.Next
Next
Tbl.Close
End Sub
DelphiScript
var
Tbl : OleVariant;
i : integer;
begin
// Create an IAQAADOTable object
Tbl := ADO.CreateADOTable;
// Specify the connection string
Tbl.ConnectionString := 'Provider=Microsoft.Jet.OLEDB.4.0;'+
'Data Source=C:\Microsoft Visual Studio\VB98\biblio.mdb';
// Specify the table name
Tbl.TableName := 'Authors';
// Open the table
Tbl.Open;
// Process the first ten records and post data to the test log
Tbl.First;
for i := 0 to 9 do
begin
Log.Message(Tbl.FieldByName('Author').Value, Tbl.FieldByName('Year Born').Value);
Tbl.Next;
end;
Tbl.Close;
end;
C++Script, C#Script
{
var Tbl, i;
// Create an IAQAADOTable object
Tbl = ADO["CreateADOTable"]();
// Specify the connection string
Tbl["ConnectionString"] = "Provider=Microsoft.Jet.OLEDB.4.0;" +
"Data Source=C:\\Microsoft Visual Studio\\VB98\\biblio.mdb";
// Specify the table name
Tbl["TableName"] = "Authors";
// Open the table
Tbl["Open"]();
// Process the first ten records and post data to the test log
Tbl["First"]();
for (i = 0; i < 10; i++)
{
Log["Message"](Tbl["FieldByName"]("Author")["Value"], Tbl["FieldByName"]("Year Born")["Value"]);
Tbl["Next"]();
}
// Close the table
Tbl["Close"]();
}
See Also
ADO.CreateADOQuery
ADO.CreateADODataset
ADO.CreateADOStoredProc
