Lecture-12 Crystal Report

download Lecture-12 Crystal Report

of 19

Transcript of Lecture-12 Crystal Report

  • 7/28/2019 Lecture-12 Crystal Report

    1/19

    Modern Programming Language

    Lecture-12

  • 7/28/2019 Lecture-12 Crystal Report

    2/19

    Crystal Reports for Visual Studio .NET

    Agenda Introduction

    Making sample crystal reports though differentmethods

  • 7/28/2019 Lecture-12 Crystal Report

    3/19

    Introduction

    Just storing data is not enough: Managers must use

    these data to make informed business decisions.Information must be properly organized, easilyaccessible and shared among various individuals,departments and affiliates.

    To make this possible, developers have createdreporting softwarea key tool enabling thepresentation of stored data sources.

    Crystal Reports was first released in 1992 as aWindows-based report writer, and Microsoft adoptedthe reporting software as the standard for VisualBasic in 1993. VisualStudio .NET integrates aspecial edition of Crystal Reports, further tying

    Crystal Reports to Windows and Web development.

  • 7/28/2019 Lecture-12 Crystal Report

    4/19

    Crystal Reports and Visual Studio .NET

    Developers working in Visual Studio .NETs Integrated

    Development Environment (IDE) can create andintegrate reports in their applications using CrystalReports software. The Visual Studio .NET edition ofthe software provides powerful capabilities todevelopers.

    A user can convert a report to Microsoft Word,Adobes Portable Document Format (PDF), HypertextMarkup Language (HTML) and others so that reportinformation can be distributed easily and used in a

    wide variety of documentation.

    Any Crystal Report created in Visual Studio .NET canbecome an embedded resource for use in Windowsand Web applications and Web services.

  • 7/28/2019 Lecture-12 Crystal Report

    5/19

    Crystal Report for VS 2010Crystal Report has been dropped from Visual Studio

    2010. But don't worry, it is available as a separatedownload from the SAP web site. These are thethings that I found from the internet.

    'It turns out that Crystal Reports for Visual Studio 2010will be released separately, instead of included with

    the product and Most importantly, Crystal Reports forVisual Studio 2010 will continue to be free, with noregistration required.

    Download Crystal report from this link, or just directly

    paste the link below to your address bar and it will askto save an EXE file.

    http://downloads.businessobjects.com/akdlm/cr4vs2010/CRforVS_13_0.exe

    Install the downloaded file then start working normally.

    http://downloads.businessobjects.com/akdlm/cr4vs2010/CRforVS_13_0.exehttp://downloads.businessobjects.com/akdlm/cr4vs2010/CRforVS_13_0.exehttp://downloads.businessobjects.com/akdlm/cr4vs2010/CRforVS_13_0.exehttp://downloads.businessobjects.com/akdlm/cr4vs2010/CRforVS_13_0.exe
  • 7/28/2019 Lecture-12 Crystal Report

    6/19

    To Bring Crystal Report ViewerControl in Vs 2010

    CrystalReportViewer is a control that are used todisplay crystal report to user.

    Follow the following steps

    Save your project

    in Menu - select ProjectWindowsApplications1Properties (go to yourproject properties)

    Click on compile tab, find forAdvance CompilerOption.

    Change Target framwork (all configurations); to.NET Framework 4

    And click ok

  • 7/28/2019 Lecture-12 Crystal Report

    7/19

    Different types of crystal report

    The following two table are needed and one view

  • 7/28/2019 Lecture-12 Crystal Report

    8/19

    Create Crystal Report from the table

    NOTE: If you are facing any problem like Unknown Query

    Engine Error you needed to add the attribute bolted belowto my *.config file.

    This is Only for .NET Framework 4.0

  • 7/28/2019 Lecture-12 Crystal Report

    9/19

    Simple Report to display data fromtable

  • 7/28/2019 Lecture-12 Crystal Report

    10/19

    Code On Button click Dim con As New SqlClient.SqlConnection("Data source=(Local);Initial catalog=Sale;Integrated security=true")

    con.Open()

    Dim da As New SqlClient.SqlDataAdapter("Select * from Customer", con)

    Dim ds As New DataSet

    da.Fill(ds,Customer)

    Dim rpt As New CrystalReport1

    rpt.SetDataSource(ds.Table(Customer))

    CrystalReportViewer1.ReportSource = rpt

  • 7/28/2019 Lecture-12 Crystal Report

    11/19

    Address vise Customers

  • 7/28/2019 Lecture-12 Crystal Report

    12/19

    Code for button con = New SqlConnection("Data source=(Local);Initial catalog=Sale;Integrated security=true")

    con.Open()

    da = New SqlDataAdapter("Select * from Customer where Address='" & Me.TextBox1.Text & "'", con)

    ds.Clear()

    da.Fill(ds, "Customer")

    Dim rpt As New CrystalReport1

    rpt.SetDataSource(ds.Tables("customer"))

    CrystalReportViewer1.ReportSource = rpt

  • 7/28/2019 Lecture-12 Crystal Report

    13/19

    Cover the following topic

    Grouping

    Section

    Page setup

    Summary Field

    Line

    TextBox

    Formate Object

  • 7/28/2019 Lecture-12 Crystal Report

    14/19

    Simple Chart in Crystal Report

    Chart is the most important and visible part of the

    reporting tool. Crystal has very powerful feature to addchart in report. Let's see how to add chart in CR.

    Right click on CR goto Insert select Chart

  • 7/28/2019 Lecture-12 Crystal Report

    15/19

    Report Inside Report (Sub Report)

    Crystal reports provide reports inside report feature

    which are normally known as a subreport feature.

    Add new report to the solution. Then add Report->Group and select only Customer name because wewant to design report for each customer and sub

    report product wise. So there will be only one groupheader inside the Customergroup

  • 7/28/2019 Lecture-12 Crystal Report

    16/19

    To Insert SubReport

    In Group section right click select Inser->SubReport

    Select your detail report Name from the list ->OK

    Drag to the group section

    Right click on subreport find Change subreport Link

    Select the field properly,

  • 7/28/2019 Lecture-12 Crystal Report

    17/19

    Cross Tab Report in Crystal Report

  • 7/28/2019 Lecture-12 Crystal Report

    18/19

  • 7/28/2019 Lecture-12 Crystal Report

    19/19

    Questions???