Description
Creates a new IAQAADODataSet object and returns a reference to it. This object allows script to navigate through dataset records and read or set their fields.
Declaration
ADO.CreateADODataset()
| Result | An IAQAADODataset object |
|||
Applies To
The method is applied to the following object:
Result Value
An object of the IAQAADODataset type.
Remarks
The IAQAADODataSet object is an analogue of a Borland VCL TADODataSet object. Methods and properties are identical.
For detailed information on the underlying TADODataSet object, see VCL documentation on ADODB classes.
Example
The following code illustrates how you can use the IAQAADODataset objects in your scripts. This example uses the Biblio.mdb database shipped with Microsoft Visual Basic. The TestProc routine copies fields from the Publishers table to 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 DSet;
// Create the new IAQAADODataset object
DSet = ADO.CreateADODataset();
// Specify the connection string
DSet.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" +
"Data Source=C:\\Microsoft Visual Studio\\VB98\\biblio.mdb";
// Specify the command type and text
DSet.CommandType = cmdTable;
DSet.CommandText = "Publishers";
// Open the dataset
DSet.Open();
// Process records of the Publishers table
DSet.First();
while (! DSet.EOF)
{
// Insert data into the test log
Log.Message(DSet.FieldByName("Name").Value, DSet.FieldByName("Address").Value);
DSet.Next();
}
DSet.Close();
}
Python
def TestProc():
# Create the new IAQAADODataset object
DSet = ADO.CreateADODataset()
# Specify the connection string
DSet.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" + "Data Source=C:\\Microsoft Visual Studio\\VB98\\biblio.mdb"
# Specify the command type and text
DSet.CommandType = cmdTable
DSet.CommandText = "Publishers"
# Open the dataset
DSet.Open()
# Process records of the Publishers table
DSet.First()
while not DSet.EOF:
# Insert data into the test log
Log.Message(DSet.FieldByName("Name").Value, DSet.FieldByName("Address").Value)
DSet.Next()
DSet.Close
VBScript
' Create the new IAQAADODataset object
Set DSet = ADO.CreateADODataset
' Specify the connection string
DSet.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" + _
"Data Source=C:\Microsoft Visual Studio\VB98\biblio.mdb"
' Specify the command type and text
DSet.CommandType = cmdTable
DSet.CommandText = "Publishers"
' Open the dataset
DSet.Open
' Process records of the Publishers table
DSet.First
While Not DSet.EOF
' Insert data into the test log
Log.Message DSet.FieldByName("Name").Value, DSet.FieldByName("Address").Value
DSet.Next
Wend
DSet.Close
End Sub
DelphiScript
var
DSet : OleVariant;
begin
// Create the new IAQAADODataset object
DSet := ADO.CreateADODataset;
// Specify the connection string
DSet.ConnectionString := 'Provider=Microsoft.Jet.OLEDB.4.0;' +
'Data Source=C:\Microsoft Visual Studio\VB98\biblio.mdb';
// Specify the command type and text
DSet.CommandType := cmdTable;
DSet.CommandText := 'Publishers';
// Open the dataset
DSet.Open;
// Process records of the Publishers table
DSet.First;
while not aqConvert.VarToBool(DSet.EOF) do
begin
// Insert data into the test log
Log.Message(DSet.FieldByName('Name').Value, DSet.FieldByName('Address').Value);
DSet.Next;
end;
DSet.Close;
end;
C++Script, C#Script
{
var DSet;
// Create the new IAQAADODataset object
DSet = ADO["CreateADODataset"]();
// Specify the connection string
DSet["ConnectionString"] = "Provider=Microsoft.Jet.OLEDB.4.0;" +
"Data Source=C:\\Microsoft Visual Studio\\VB98\\BIBLIO.MDB";
// Specify the command type and text
DSet["CommandType"] = 2 /* cmdTable */;
DSet["CommandText"] = "Publishers";
// Open the dataset
DSet["Open"]();
// Process records of the Publishers table
DSet["First"]();
while (!DSet["EOF"])
{
// Insert data into the test log
Log["Message"](DSet["FieldByName"]("Name")["Value"], DSet["FieldByName"]("Address")["Value"]);
DSet["Next"]();
}
DSet["Close"]();
}
See Also
ADO.CreateRecordset
ADO.CreateADOTable
ADO.CreateADOQuery
ADO.CreateADOStoredProc
