Generally when designing a fastReport report, you can directly save the database connection information into the report. However, there is a serious security problem in this way, which is how the client can see the database account and password when using the designer to reopen the report. , which is very unsafe for the database system, so here we have made some settings to remove the account information from the report.
Open the report designer, find the data connection item, and delete the connection information stored in the ConncetionString in the property. Of course, if you delete it directly like this, the report will not be able to find the data, so we have to send the database connection information to the report in the program.
In the program, we directly read the data from the database and store it in the dataset, and then pay it to the report. This way we don’t need to pass the data connection information separately. In the early days There is a setting for transmitting connection information in the version, but after experiments, it was found that it is not easy to use. It is not as simple as pushing the dataset directly. The name of the data table stored in the dataset is "Table". If it is not this, you can output it and view it, because the same name needs to be set in the report so that both sides can correspond.
Here we change the name of the data table that needs to be displayed to Table, which is consistent with the program, otherwise an error message will be reported later Can't get data.
After the above settings, the report can be displayed, but it is likely that only one piece of data will appear. If this is the case, you need to set it again according to the following method Check out the report.
The above is the detailed content of Detailed introduction to FastReport report and removal of database connection information to enhance system security (picture). For more information, please follow other related articles on the PHP Chinese website!