RAD Studio
ContentsIndex
PreviousUpNext
Accessing the Connection's Datasets

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:  

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

 

for (int i = 0; i < ADOConnection2->CommandCount; i++)
  ADOConnection2->Commands[i]->Execute();
Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!