In the daily and weekly check-out sections of the data room charging system, we use reports. Let's first take a look at what the reports are.
A report dynamically displays data in tables, charts, and other formats. The formula can be used to indicate: "report = diverse formats + Dynamic Data ". Before there was no computer, there were also reports, which were manually recorded by some tables and simple charts as needed. And then summarize them regularly. When a computer appears, people use the computer's data processing and interface design functions to generate and display reports. A report on a computer is characterized by dynamic data and diversified formats. In addition, the report data is completely separated from the report format. You can modify only the data or only the format.
I am using the "Grid ++ report designer 2009". The following describes how to use the weekly report.
1. Select File-new wizard-design Master title and subtitle.
2: connecting to the database is similar to creating a data source. There are no duplicates here. Remember to test the connection.
3: In the dialog box that appears, the database connection string will automatically display the code of the information we just set (Note: Sometimes we need to manually add the Database Password ), then, enter the database table required for table creation in SQL. Click test to check whether the connection is successful.
4. Define the field type and field title. The actual operation will be clear.
The created table is displayed.
Here, I would like to remind you that you should learn to use various functions in the insert, especially the combination of various text boxes and parameters, but implement many functions, such as displaying the time period of our query.
Finally, it is the connection with VB. First, add the report control to VB. Select project-component.
The following is the interface and code:
Dim report as grprolibctl. gridppreportprivate sub into checkday_click () dim txtsql as string dim msgtext as string dim objrs as ADODB. recordset txtsql = "select * From checkday_info where checkdate between '" & trim (starttime. value) & "'and'" & trim (endtime. value) & "'"' parameter settings of the report, showing the time period report. parameterbyname ("startdate "). asstring = STR (starttime. value) report. parameterbyname ("enddate "). asstring = endtime. value report. detailgrid. recordset. querysql = txtsql 'view the report grdisplayviewer1.refresh grdisplayviewer1.start end sub 'print the report private sub into stamp_click () report. [print] (true) end sub 'print and preview private sub into stampview_click () report. printpreview (true) end sub