we are here to the computer room charge system week checkout list For example, explain VS2008 production of reports
Create a new form, drag one from the Toolbox Microsoftreportviewer control to the form, click Microsoftreportviewer the small triangle on the right, then select Design a new report
Select an existing data source or add a new data source
We add a data source here
Select an existing connection or create a new connection
We create a new connection here, after testing the connection successfully, select OK
Then click Next, select Database object, click Finish
Select the newly added data source and select Next
Select the left field, click Details, click Next
Click Next, rename the report, click Finish
we go into the report design form, the toolbox appears on the left side of the form, the data source, and we can also view - Tool Bar , Select the appropriate report menu.
Note that each small pane in the diagram is a text box, and we can manually enter the text to be displayed, or you can right-click a single text box and select the expression as needed.
Note: The return value of the selected function must be the same as the set data type of the parameter, otherwise it will appear: Error prompt inside report
we define the corresponding endDate
After you have designed the report, close the Design Report window, select the report source by right-clicking the ReportViewer1 control's small triangle, and after selecting, we can see the database connection control in the lower corner of the form.
We assign values to individual text boxes by right-clicking the text box selection expression and layout the report (WYSIWYG)
We need to configure the dataset by using the wizard
We can get the data we want by adding or configuring an existing query, and then through the Query Builder
Execute the query, input parameters, verify the correctness of the query statement
Private Sub Btnquery_click (ByVal sender as System.Object, ByVal e as System.EventArgs) Handles Btnquery.click Begi Ndate = BeginDatePicker.Text.Trim EndDate = EndDatePicker.Text.Trim ' report parameter, note that the string "" must match the parameters in the report, be case-sensitive, or it will be reported Wrong Dim params () as ReportParameter = {New ReportParameter ("AdminName", admin. Name), _ New reportparameter ("Begindate", Begindate), _ New ReportParameter ("EndDate", EndDate), _ New ReportParameter ("Stime", Format (now, "HH:mm:ss"))} ' Accept report parameter ReportViewer1.LocalReport.SetParameters (params) ' uses the query statements from the dataset we previously edited with the designer to load the data for our report, and we need to provide the parameters in the query statement Me.T_WStatement_infoTableAdapter.FillWeek (Me.Room_Charge_SystemDataSet1.T_WStatement_info, Begindate, EndDate) Me.T_DStatement_infoTableAdapter.FillWeek (Me.Room_Charge_SystemDataSet.T_DStatement_info, Begindate, EndDate) Me.ReportViewer1.ReFreshreport () End Sub
the production of this report is time-consuming and laborious, before reading a Trichengrong Brother Siang blog, which has"Report Data"One item,you can drag parameters directly into the text box, but brother Siang uses theVS2010Oh, I used it.VS2008Yes, this version is different, the parameter is added in the same way, now only knowVS2008is to add parameters by right-clicking the text box through the expression. Oh, everything can not be a dead-ends ah, time-consuming effort also cost feelings.
Vb. NET travel-production of reports (RDLC)