This section briefly introduces how to use reporting service to create reports.

Source: Internet
Author: User
1) after the reporting service is installed, open Visual Studio. NET, select new project, choose create Business Intelligence Project, select create a report project, name it reportservice1, and then select OK, for example:


2) then, in Solution Explorer, right-click the shared data source, select "Add new data source", select the location of the SQL Server server, and select use the northwind database, press OK to create a new shared data source, northwind. RDS (you can change the name of the data source). The purpose of creating a shared data source is to reference the data connection easily in future report design.

3) In Solution Explorer, right-click report, point to add, and click Add new item ". In add new item, click report ".
In the "name" box, type "report1.rdl" and click "open ". A view contains the "data", "layout", and "preview" tabs. As shown in:


4) to connect a report to a database, you must create a new dataset. Drop-down list of "dataset" at the top
In the table box, click the drop-down list box and select "new dataset". The "dataset" dialog box is displayed. Because we have already created a shared data source, in the displayed window, we can see that
The existing data source northwind can also be renamed. Here we keep the dataset name dataset1 unchanged. At the same time, we can choose whether the command type to be queried is text or
Is a stored procedure. You can enter an SQL statement or stored procedure in the query string below. Here we do not make a choice, simply press OK, for example:


5) in the data design window that appears, you can directly enter the SQL query statement: Select * from orders, and then press! To run the SQL statement. You can immediately see the query results, and then press save to save the dataset.


6) switch to the Layout View. Here, we can see that there are tool option panel and
Field Selection Panel. In the tool panel, there are various tools used to prepare reports, such as picturesque lines, images, and text box objects. In the field panel, fields under the current dataset are listed. In the middle layout area, you can
The rectangular area in the middle is the place where the report is drawn. In this example, we only need to edit several fields in the field area, such
Orderid, customerid, orderdate, drag to the second line of the rectangular box in the design area (the first line is the header, and the third line is the end of the table), and change the header to appropriate text, such
:


7) Now, we have completed a simple report design. You can click preview report. NOTE: If your
If you select SQL Server login verification, you must first select a shared data source, and then enter login SQL IN THE creden
Server user name and password. Click the preview button to view the report effect, for example:


8) Next, we will deploy our reports. Click the properties page of the Project reportservice. In the displayed Configuration Manager
Enter the server of the report to be deployed in the targerserverurl. Enter http: // localhost/reportserver here because
Reporting
In service, the default Report Server is installed in the virtual directory of reportserver. Right-click the reportsevice project and select "deploy ".
The report service is automatically deployed.


9) Finally, open IE and enter http: // localhost/reportserver to view the reports deployed on the Report Server. Note that you can export the report to PDF, Excel, txt, and other files in the export format drop-down table. You can try it.


The emergence of Reporting Service undoubtedly gives developers an additional choice when creating reports. There are still many skills and related knowledge. This article is just a reference, for more information, see the online series of reporting services.

Posted on 2008-04-28 freeliver54 read (184) Comments (4) edit the category of the favorites: VS technical example, report, SQL

Comment #1 floor [main poster]



Freeliver54

[Switch] access the call report page:

-----------------

In your ASP. NET project, create a web page and add the reportview control reportviewer1.

Modify the reportserverurl and reportpath attributes:

Reportserverurl = http: // CTC-bar: 81/reportserver (CTC-bar is the name of your report server. I added: 81 because port 81 is used here)

Reportpath =/barreports/ebcdetaillist (/barreports/ebcdetaillist is the path of your report. Pay attention to the previous /)

Now you can use this report. When you run your program, a report appears at the position of reportview, which is the same as accessing a report from a URL.

Now, I want to do some work on the input parameters of the report. My report has two time parameters: Start Time and end time. It is inconvenient to enter 2007-1-1 in the text input box. I want to add a date Selection control on the Web page instead of entering the date directly.

Two steps are required:

1. Set showparameterprompts to false. That is, disable the parameter input area provided by the Report Server.

2. Add the start date and end date controls and a virew Report button on the web page.

In the Click Event of the virew Report button, pass the date control value to the server using the setparameters method. Similar

Protected void buttonviewreport_click (Object sender, eventargs E)

{

Datetime startdate = system. Convert. todatetime (textboxstartdate. value );

Datetime enddate = system. Convert. todatetime (textboxenddate. value );

Reportparameter [] parameters = new reportparameter [2];

Parameters [0] = new reportparameter ("startdate", startdate. to1_datestring ());

Parameters [1] = new reportparameter ("enddate", enddate. to1_datestring ());

Reportviewer1.serverreport. setparameters (parameters );

}

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.