lecture 9 report

Upload: mekonnen-fentaw

Post on 03-Jun-2018

218 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/12/2019 Lecture 9 Report

    1/17

  • 8/12/2019 Lecture 9 Report

    2/17

    2

    Introduction

    Report

    Local

    Remote

  • 8/12/2019 Lecture 9 Report

    3/17

  • 8/12/2019 Lecture 9 Report

    4/17

    4

    Overview of Reporting Services

    Reporting Services is a scalable, secure, robustreporting solution for SQL Server. It supports thecomplete reporting lifecycle by including tools forreport creation, execution, distribution, andmanagement. New users can have Reporting

    Services installed and new reports published withina matter of minutes instead of days or weeks.

    Reporting Services consists of the following keycomponents:

    Report Designer: Supports the report creationphase of the report lifecycle. It is an add-on tool forany edition of Visual Studio .NET, suitable for bothprogrammers and non-programmers.

    Report Server: Provides services for execution and

    distribution of reports. Report Manager: A Web-based administration tool

  • 8/12/2019 Lecture 9 Report

    5/17

    5

    Supported report types

  • 8/12/2019 Lecture 9 Report

    6/17

    6

    Report file format

    Microsoft Report is in rdl and rdlc file formats. Report,

    Definition Langauge

    Client

    What is the difference between RDL and RDLC formats?A: RDL files are created by the SQL Server xxxx version of ReportDesigner. RDLC files are created by the Visual Studio xxxx version

    of Report Designer. RDL and RDLC formats have the same XML schema. However, in

    RDLC files, some values (such as query text) are allowed to beempty, which means that they are not immediately ready to bepublished to a Report Server.

    RDL reports are HOSTED reports generally. Thismeans you need to implement SSRS Server. RDLCreports are CLIENT CONTAINED reports that are NOTHOSTED ANYWHERE. Generally this is an extension of theRDL language meant for use only in Visual Studio Client

    Applications. It exists in Visual Studio when you add a'reporting' item.

  • 8/12/2019 Lecture 9 Report

    7/17

  • 8/12/2019 Lecture 9 Report

    8/17

    8

    To develop RDL report, we need to createA Report Server Project

    Design report

  • 8/12/2019 Lecture 9 Report

    9/17

  • 8/12/2019 Lecture 9 Report

    10/17

    Report Design Evironment

  • 8/12/2019 Lecture 9 Report

    11/17

  • 8/12/2019 Lecture 9 Report

    12/17

    Design windows form that has at least one

    Microsoft report viewer controls

    1. Drag and drop

    MicrosoftReportView control on the form,

    5. Click smart tag of thereport viewer andchoose the name of

    the report createdbefore(e.g. report ) inthe choose reportcombo box

    6. Change the dockproperties of thereport view and thentest your report

  • 8/12/2019 Lecture 9 Report

    13/17

    Design windows form that has at least one

    Microsoft report viewer controls

    What are you going

    to do if you are

    asked to display

    customers list of

    selected companyfrom combo box

    as shown in the

    figure on the righthand side?

  • 8/12/2019 Lecture 9 Report

    14/17

    Design windows form that has at least

    one Microsoft report viewer controls

    Populate values of combo box by adding codes toForm)LoadSqlConnection con = new SqlConnection("Data Source=DMT2005-

    PC;Initial Catalog=Northwind;Integrated Security=True");

    SqlCommand cmd = new SqlCommand("select distinct Cityfrom Customers", con);

    con.Open();

    SqlDataReader reader = cmd.ExecuteReader();

    while (reader.Read()) {

    comboBox1.Items.Add(reader[0]);

    }

    con.Close();

  • 8/12/2019 Lecture 9 Report

    15/17

    Design windows form that has at least

    one Microsoft report viewer controls

    add the following code to buttonDataSet ds = new DataSet("Customerds");

    ds = GetCustomersList();

    reportViewer1.LocalReport.ReportPath= "E:\\courses\\2006\\second

    semester\\Visual

    Programming\\lab\\WindowsFormsApplication3\\WindowsFormsApplication3\\Report1.rdlc";

    reportViewer1.LocalReport.DataSources.Clear();

    reportViewer1.LocalReport.DataSources.

    Add (new ReportDataSource("NorthwindDataSet_Customers", ds.Tables[0]));

    this.reportViewer1.RefreshReport();

  • 8/12/2019 Lecture 9 Report

    16/17

    Design windows form that has at least

    one Microsoft report viewer controls

    DataSet GetCustomersList() {DataSet customerDs = new DataSet("customerds");

    SqlConnection con = new SqlConnection("Data Source=DMT2005-

    PC;Initial Catalog=Northwind;Integrated Security=True");

    con.Open();

    SqlDataAdapter da = new SqlDataAdapter("select * from customers" +" where City='" +

    comboBox1.SelectedItem.ToString() + "'", con);

    da.Fill(customerDs);

    con.Close();

    return customerDs;}

  • 8/12/2019 Lecture 9 Report

    17/17

    Other features of Reports

    Grouping

    Using aggregated functions