Objective:
Report as a major focus of the computer room charge system, its main process is divided into report design-database connection-VB and report interaction. Let's look at the report design first.
1. First download the installation Report Designer, it is commonly used by grid++report5.0
Download Link: http://xiazai.zol.com.cn/detail/27/262835.shtml
Add corresponding parts in VB
2. Open the Editor--insert a report header--Insert a static box to fill in the required content in a static box
Add time to insert a system variable box--In the Properties box--Data--Select date format
3. Insert Detail GRID--Enter SQL query statement--click the image below to establish a connection to the database
Click Create database connection and follow the instructions
Import the fields from the Database Checkday_info table into the grid (below two items)--Change the table header
4.vb code to interact with the report:
Similar to export Excel is defined first and then the assignment is finally performed using the
Dim report as Grprolibctl.gridppreport ' materialized reports
Private Sub Form_Load ()
Dim TxtSQL as String ' instantiation report ', '
Set ' = ' New grprolibctl.gridppreport ' Report established location
report.loadfromfile App.Path & "\CHECKDAY.GRF"
Report.DetailGrid.Recordset.ConnectionString = ConnectString ' data source connection database directly invokes the written module content
TxtSQL = "SELECT * from Checkday_info"
Report.DetailGrid.Recordset.QuerySQL = TxtSQL ' View reports
Grdisplayviewer1.report = Report ' Display reports
Grdisplayviewer1.start
End Sub
Summary:
Report learning a stage, in the process of learning is constantly have such sentiment: many times are difficult psychological hint frightened us rather than the difficulty itself, computer learning or need us to fall into the heart of the special research, all the problems are paper tigers.