First, the theory of using the data module can be see, which is very detailed: https://wenku.baidu.com/view/073aa98aa0116c175f0e48e2.html
Second, why use data module?
Its main role is:
1. Improve reuse of data components
2. Easy data centralized management and maintenance
3. The program structure is more clear, the data set is placed separately, the form is only responsible for user interface, the program structure is clearer;
Contrast:
Before use:
After use:
How to use the Data module:
1th Step: file/new/other/
2nd Step: Point Data module, click OK;
3rd Step: Add the DataSet components as needed, such as ADO connection \ado query \ado table \data source, etc.;
4th Step: Open the form interface that needs to use the dataset, point File/use Unit
5th step: Select the unit file name of the data module, add the reference execution, click OK;
6th step: Next, you can add a dataset directly to the form and add it as appropriate.
How to use the data Module of Delphi to manage database connection, adoquery and datasourse, etc.