As you create a new dbExpress application (or open an existing one), and select the SQLConnection component editor (the shortcut menu of the component) you'll immediately see something different from the past:
The Connection editor command (Edit Connection Properties) and the corresponding dialog box are gone, and so has the dialog box with the list of installed drivers. You now have two choices for modifying the dbExpress configuration: The first is to manually edit the dbxdrivers.ini and dbxcon-nections.ini files or and the second is to use the SQLConnection component, its properties, and its new component editor commands. In particular, after you've selected a connection, you can choose from:
• Reload connection parameters will copy the dbxconnections.ini setting to the SQLConnection component for the current configuration. Notice that when the settings have been modified, compared to the original version, the ConnectionName property in the Object Inspector will have an asterisk after its name, indicating a modified set of connection data:
SQLConnectlonl TSQLConnection I Properties | Events I_
IBCON NECTIQN InterBase
For the specific demo, adding the connection string parameter will add a ConnectionString line to the Params property, with the following content (which I've split on to multiple lines for readability, while it has to be in a single line because it is part of a TStringList):
Borland.Data.TDBXDynalinkDriverLoader, DRIVERASSEMBLY=Borland.Data.DbxCommonDriver, Version=11.0.5000.0, Culture=neutral,
INTERBASE TRANSISOLATION=ReadCommited, TRIM CHAR=False
Notice that this one-line configuration setting includes standard database settings (in the last part), driver configuration settings, the actual database to connect to, and even delegate driver information.
This new approach is based on a new internal data structure, the TConnectionData persistent class, that can be accessed using the new ConnectionData read-only property of the SQLConnection component. This class stores all configuration settings in an internal TBDXProperties list, can refer to a further TConnectionData structure with a delegate connection, and has support methods like:
procedure UpdateProperties(NewProperties: TStrings);
procedure AddProperties(NewProperties: TStrings);
As an example I've used this property to extract the connection string from the ConnectionData (information also available in the connection Params property). I've written this code in the OnExecute event handler action that I've added to the ActionManager component of the program:
procedure TForm1.ActionGetInfoExecute(Sender: TObject); begi n
ShowMessage (SQLConnectionl.ConnectionData. Properties [ 'ConnectionString']);
Was this article helpful?
What you need to know about… Project Management Made Easy! Project management consists of more than just a large building project and can encompass small projects as well. No matter what the size of your project, you need to have some sort of project management. How you manage your project has everything to do with its outcome.