To get the database for the example, use the Mimer Administrator to create a new database called example_db. Tell the database installation wizard to create the Mimer SQL Example environment.
We are now ready to create the database application!
Start Delphi 7.
Click the dbExpress component tab:
Click the SQLConnection component button
Click somewhere on the form to place the SQLConnection component.
Double-click on the SQLConnection component that you placed on the form.
Click the Add Connection button
Select MIMER in the Driver Name field and write a Connection Name, in this case example1. Click OK.
Click on the example1 Connection name. Now, look at the Connection Settings table. Change the Database key value to example_db, set the User_Name key value to mimer_store and set the Password key value to GoodiesRUs.
Click the Test Connection button to verify the Connection. In the Database Login dialog box, write the password GoodiesRUs and click OK.
A dialog box saying Successfully Connected should be visible now. Click OK to close the Successfully Connected dialog box.
Click OK in the dbExpress Connections dialog to apply the changes made to the SQLConnection component and to close the dialog box.
Click the SQLTable component button in the dbExpress component palette.
Click somewhere on the form to place the SQLTable component. In the Object Inspector, set the SQLConnection property to SQLConnection1 and set the TableName property to CURRENCIES.
Click the Data Access component tab:
Click the DataSetProvider component button
Place the DataSetProvider component on the form by clicking somewhere on the form. In the Object Inspector, set the DataSet property to SQLTable1.
Click the ClientDataSet component button
Place the ClientDataSet component on the form by clicking somewhere on the form. In the Object Inspector, set the Active property to True and set the ProviderName property to DataSetProvider1.
Click the DataSource1 component button
Place the DataSource1 component on the form by clicking somewhere on the form. In the Object Inspector, set the DataSet property to ClientDataSet1.
Click the Data Controls component tab:
Click the DBGrid component button
Place the DBGrid component on the form by clicking somewhere on the form. In the Object Inspector, set the DataSource property to DataSource1.
Click the Standard component tab:
Click the Button component button
Place the Button component on the form by clicking somewhere on the form. In the Object Inspector, set the Caption property to &Update. Double-click on the Update button on the form to create code for the OnClick event. Add the following code to the Button1Click procedure:
The Button1Click procedure should look like this:
procedure TForm1.Button1Click(Sender: TObject);
You can now arrange the components to give the application a look that suits you. Here is a picture on how the supplied example project is arranged:
You are now ready to run the application. Click the Run button in the Run toolbar. (As an alternative you can choose the Run option in the Run menu or press F9 to run the application). You should now see a Database Login dialog box. This dialog box will connect to the example1 database that we defined in the SQLConnection component. The User Name field displays mimer_store, but the password field is empty. Write GoodiesRUs in the password field and click OK.
The application should now display a grid covering the CURRENCIES table with the three columns CODE, CURRENCY and EXCHANGE_RATE. There is also an Update button which is used to commit grid changes to the database.
Here is a picture of the application running:
This article can also be used if you are developing in Borland C++ Builder. Actually, this example procedure would look exactly the same!
The Mimer dbExpress Driver is distributed for free under the terms of the GNU Lesser General Public License.