ADO datasets can connect to an ADO data store either collectively or individually.
When connecting datasets collectively, set the Connection property of each dataset to a TADOConnection component. Each dataset then uses the ADO connection component's connection.
ADODataSet1.Connection := ADOConnection1; ADODataSet2.Connection := ADOConnection1; ...
ADODataSet1->Connection = ADOConnection1; ADODataSet2->Connection = ADOConnection1; ...
Among the advantages of connecting datasets collectively are:
When connecting datasets individually, set the ConnectionString property of each dataset. Each dataset that uses ConnectionString establishes its own connection to the data store, independent of any other dataset connection in the application.
The ConnectionString property of ADO datasets works the same way as the ConnectionString property of TADOConnection: it is a set of semicolon-delimited connection parameters such as the following:
ADODataSet1.ConnectionString := "Provider=YourProvider;Password=SecretWord;" + "User ID=JaneDoe;SERVER=PURGATORY;UID=JaneDoe;PWD=SecretWord;" + "Initial Catalog=Employee";
ADODataSet1->ConnectionString = "Provider=YourProvider;Password=SecretWord;"; ADODataSet1->ConnectionString += "User ID=JaneDoe;SERVER=PURGATORY"; ADODataSet1->ConnectionString += "UID=JaneDoe;PWD=SecretWord;" ADODataSet1->ConnectionString += "Initial Catalog=Employee";
At design time you can use the Connection String Editor to help you build the connection string. For more information about connection strings, see Connecting to a data store using TADOConnection.
Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
|
What do you think about this topic? Send feedback!
|