Use of locally loaded reporting reports in Visual Studio 2010

Source: Internet
Author: User
Tags visual studio 2010

This company has not been in touch for a long time. It has never been used before. First, it reviews the workflow engine and various email and text messages, and then deploys a Reporting Server.

Reporting Service deployment is not mentioned here. In vs2010, you can directly add a reporting report.

 

This is a blank template. When the Template already exists, the data will be poor. A new dataset will be added to the template.

When the dataset has a template, return to the reporting template page and design the format on it. Right-click in the blank space and choose insert-table (or other charts) to select a data source.

 

In this case, the report template is the same as the Web Control to set fields.

The template setting is complete. Then write the corresponding HTML for loading the page aspx as follows:

<Rsweb: reportviewer id = "rvreport" runat = "server" font-names = "verdana" font-size = "8pt" waitmessagefont-size = "14pt" interactivedeviceinfos = "(SET) "waitmessagefont-names =" verdana "width =" 100% "Height =" 90% "> <localreport reportpath =" reportfiles \ repaircountreport. rdlc "> <datasources> <rsweb: reportdatasource performanceid =" objectperformance1 "name =" dataset1 "/> </datasources> </localreport> </rsweb: reportviewer> <asp: objectdatasource id = "objectdatasource1" runat = "server"> </ASP: objectdatasource>

The following code loads data in the CS file:

Private void initdatagrid () {string betweenbegin = betweenbegin. value; string betweenend = betweenend. value; If (string. isnullorwhitespace (betweenbegin) | string. isnullorwhitespace (betweenend) {prompthelper. showmessagejbox ("tip", "Enter the query interval", this); Return ;}// by default, it is selected, that is, the petrol station name is selected as the group string groupbyvalue = ""; if (ckouname. checked) {groupbyvalue = "1";} else {groupbyvalue = radiobuttonlist1.selectedva Lue;} sqlwhere = "and (t1.actualfinishdate between '" + betweenbegin + "' and '" + betweenend + "')"; string ouname = ouname. value; If (! String. isnullorwhitespace (ouname) & ouname! = "Petrol station name") {sqlwhere + = "and t3.ouname like '%" + ouname + "%'" ;}// obtain data first sqlhelper helper = new sqlhelper (); sqlparameter [] par = new sqlparameter [] {New sqlparameter ("@ sqlwhere", sqldbtype. varchar, 1000), new sqlparameter ("@ groupby", sqldbtype. varchar, 2)}; par [0]. value = sqlwhere; par [1]. value = groupbyvalue; dataset dataset1 = helper. executedataset (commandtype. storedprocedure, "proc_repaircountreport", par); this. rvreport. visible = true; this. rvreport. localreport. datasources. clear (); objectperformance1.selectparameters. clear (); objectperformance1.selectparameters. add ("sqlwhere", sqlwhere); this. rvreport. localreport. datasources. add (New reportdatasource ("dataset1", dataset1.tables [0]); this. rvreport. localreport. refresh ();}

Even if the entire report has been completed, let's see the results.

 

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.