Delphi application client
In the object inspector in the Caption property of the Forml form lets enter a name of the form.
Note that the constant data base file name is specified in the Data BaseName property, component Data Base complicates transfer to other computers. So, lets put Panel component from the Standard tab in the top part of the form and lets place the the following components from the Standard tab:
- Label (in Caption property enter " data base file");
- Edit (to enter the path to the data base; delete the information in the Text property, in the Name property type in Ed Data BaseName);
- Button (to activate dialogue; selecting the data base file; Caption Name - BtOpen);
- Button (to initiate the update information obtained from the data base; Сарtion - «Update»; Name - BtRefresh).
Additionally, you should place on the form (below the Panel component) component-dialog base name selection - OpenDialog from the Dialogs tab (lets rename OpenDialogl component to OpenDialog).
Set on the form (below the Panel component) TDBGrid components ( DataControis tab), DataSourse ( Data Access tab). Accordingly, components in the program will be named DBGridl and DataSourcel.
Save the project (the tool ).
Now you need to join a DBGridl table with DateModuie components. Make active the window of main form of the project, select the menu File - UseUnit and in the appeared window select the desired module (unit2). Only now in the DataSet property of the DataSourse 1 component we can set the name of our "qomain" component from the dropdown list. In DBGridl component set the property DataSourse in DataSourcel.
In order, in the fields of the column names of the DBGridl component, inscriptions displayed in Russian, you have to perform the following steps:
- Highlight DBGridl component, select a property Columns in the object inspector. When you click on the ellipsis button opens the editor of columns;
- Create the necessary number of the objects of TColumn class (by the number of columns in a Otd table);
- Highlight the first object of TColumn. In the object inspector in the FieldName property of the specified object open the list and select the appropriate field of the Otd table (we recall that in the SQL property of "qo main" component, associated with DBGridl component, previously was entered query: select all fields from Otd table);
- Click on the "+" before the Title property. In the opened Caption property, enter the desired name of the column (number, name, or budget). (In the example, the column name in Russian is duplicated by real name of table field, as used interface of insertion and removal envisages compilation of logical conditions to select table records);
- In the Alignment property inside the Title property, choose taCenter from the drop-down list;
- Perform 3-5 steps with all other objects of TColum.