C # Data Center reconstruction-report production

Source: Internet
Author: User

C # Data Center reconstruction-report production
Preface

Different from other report software that VB needs to reference, VS has its own report design function. The first attempt is to feel its power.

Report Creation

Let's not talk much about the process of directly generating reports.

1. First, we need to create a report container. Put it on the form where the report is displayed.

2. Add a report.

3. After the report is added, we can see the relevant data of the report.

4. Add the data source and dataset in sequence and test the connection.

5. After the operation is successful. Add the parameters to be used.

6. Then we can add what we need in the report toolbox, such as tables and text boxes. The table here can directly reference the content in the dataset. Click the small icon in the table.

7. reference the data source dataset.

Well, some basic configurations are completed here. Next is the code.

Code
Private void btnInquire_Click (object sender, EventArgs e) {string BeginDate = dtpBegin. text. trim (); string EndDate = dtpEnd. text. trim (); Facade. facade faca = new Facade. facade (); DataTable table = faca. inqCheckInfo (BeginDate, EndDate); ReportDataSource rptDataSource = new ReportDataSource (); ReportParameter [] Params = {new ReportParameter ("ID", Entity. model. user), new ReportParameter ("CheckDate", DateTime. now. toShortDateString ()}; rptDataSource. name = "DataSetCheckReport"; // specify the dataset Name rptDataSource. value = table; // data source name reportViewer. localReport. reportEmbeddedResource = "UI. checkReport. rdlc "; // report file name reportViewer. localReport. dataSources. clear (); // Clear the report reportViewer. localReport. dataSources. add (rptDataSource); // Add the data source reportViewer. localReport. setParameters (Params); // pass the reportViewer parameter. refreshReport (); // refresh report control}
Similar to the Code in layer D, the parameter is first input and then executed. The execution steps are as follows. Summary

If you encounter any difficulties during the report production process, you have to say that the problem occurs when the parameters are passed in. Most of the problems are caused by naming, right-clicking parameters, setting properties, and being careful, make sure that the variable name is correctly displayed in the report.

After completing the report, you may find that the report is not only capable of displaying data, but also has many functions, user friendly. I feel that I not only have too much room for improvement in technology, but also have too much room for improvement in interface friendliness. Therefore, it is not important to do software. What is important is how many people like it.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.