RAD Studio |  |

Accessing the Connection's Datasets
See Also
Collapse All

Like other database connection components, you can access the datasets associated with the connection using the DataSets and DataSetCount properties. However, dbGo also includes TADOCommand objects, which are not datasets, but which maintain a similar relationship to the connection component.

You can use the Commands and CommandCount properties of TADOConnection to access the associated ADO command objects in the same way you use the DataSets and DataSetCount properties to access the associated datasets. Unlike DataSets and DataSetCount, which only list active datasets, Commands and CommandCount provide references to all TADOCommand components associated with the connection component.

Commands is a zero-based array of references to ADO command components. CommandCount provides a total count of all of the commands listed in Commands. You can use these properties together to iterate through all the commands that use a connection component, as illustrated in the following code:

Copy Code

    var
      i: Integer
    begin
      for i := 0 to (ADOConnection1.CommandCount - 1) do
        ADOConnection1.Commands[i].Execute;
    end;

Copy Code

    for (int i = 0; i < ADOConnection2->CommandCount; i++)
      ADOConnection2->Commands[i]->Execute();

See Also

Connecting to Databases

Connecting to a Data Store Using TADOConnection

Connecting to a Data Store Using TADOConnection

ADO Connection Events

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!