.Net Crystal Reports Name: Justin John Date: 06-19-2007.

Slides:



Advertisements
Similar presentations
Chapter 10 Database Applications Copyright © 2011 by The McGraw-Hill Companies, Inc. All Rights Reserved. McGraw-Hill.
Advertisements

.NET C RYSTAL R EPORTS …Vishal Kumar.. I NTRODUCTION T O C RYSTAL REPORT :- For creating interactive reports that can be integrated into a wide range.
DEV392: Extending SharePoint Products And Technologies Through Web Parts And ASP.NET Clint Covington, Program Manager Data And Developer Services - Office.
Chapter 12: Using ADO.NET 2.0 Programming with Microsoft Visual Basic 2005, Third Edition.
Introduction to Database Processing with ADO.NET.
1 Chapter 12 Working With Access 2000 on the Internet.
Integrating Access with the Web and with Other Programs.
The ADO Data Control. Universal Data Access Open Database Connectivity (ODBC) –standard for accessing data in databases OLE-DB –allows access to data.
Using Visual Basic 6.0 to Create Web-Based Database Applications
Chapter 12: ADO.NET and ASP.NET Programming with Microsoft Visual Basic.NET, Second Edition.
ASP.NET Programming with C# and SQL Server First Edition
ASP.NET Programming with C# and SQL Server First Edition Chapter 8 Manipulating SQL Server Databases with ASP.NET.
Chapter 14: Advanced Topics: DBMS, SQL, and ASP.NET
Chapter 12 Database Connectivity with ASP.NET JavaScript, Third Edition.
MCDST : Supporting Users and Troubleshooting a Microsoft Windows XP Operating System Chapter 5: User Environment and Multiple Languages.
Chapter 7 Managing Data Sources. ASP.NET 2.0, Third Edition2.
SQL Reporting Services Overview SSRS includes all the development and management pieces necessary to publish end user reports in  HTML  PDF 
1 Chapter 20 — Creating Web Projects Microsoft Visual Basic.NET, Introduction to Programming.
Slide 1 of 9 Presenting 24x7 Scheduler The art of computer automation Press PageDown key or click to advance.
XP New Perspectives on Microsoft Access 2002 Tutorial 71 Microsoft Access 2002 Tutorial 7 – Integrating Access With the Web and With Other Programs.
Microsoft Visual Basic 2012 CHAPTER ONE Introduction to Visual Basic 2012 Programming.
Create with SharePoint 2010 Jen Dodd Sr. Solutions Consultant
“This presentation is for informational purposes only and may not be incorporated into a contract or agreement.”
Chapter 8 Binding Data to Web Controls. ASP.NET 2.0, Third Edition2.
11 Chapter 3: Getting Started with Tasks 3.1 Introduction to Tasks and Wizards 3.2 Creating a Frequency Report 3.3 Generating HTML, PDF, and RTF Output.
CHAPTER 9 DATABASE MANAGEMENT © Prepared By: Razif Razali.
Copyright © 2005, 2006 Beta V Corporation All rights reserved Hitchhiker’s Guide to Visual Studio and SQL Server – Innovations in Reporting William R.
Chapter 11 Introduction to Database Processing. Class 11: Database Processing Use a Visual Studio Wizard to establish a database connection used to load.
Advanced Forms Lesson 10.
Basics of Web Databases With the advent of Web database technology, Web pages are no longer static, but dynamic with connection to a back-end database.
1 Lesson 6 — Database Programming Microsoft Visual Basic.NET, Introduction to Programming.
ASP.NET The.NET Framework. The.NET Framework is Microsoft’s distributed run-time environment for creating, deploying, and using applications over the.
Using Visual Basic 6.0 to Create Web-Based Database Applications
Creating Web Applications Using ASP.NET Chapter Microsoft Visual Basic.NET: Reloaded 1.
Chapter 1 Getting Started with VB.NET and Crystal Reports Debbie St. George Wonder Ranch Publishing DBA/Programmer Covington Visual Studio.Net User Group.
Introducing Reporting Services for SQL Server 2005.
Virtual techdays INDIA │ Nov 2010 Developing Office Biz Application using WPF on Windows 7 Sarang Datye │ Sr. Consultant, Microsoft Sridhar Poduri.
Developing Reporting Solutions with SQL Server
Fundamentals of Database Chapter 7 Database Technologies.
Overview of Data Access MacDonald Ch. 15 MIS 324 Professor Sandvig.
Tutorial 121 Creating a New Web Forms Page You will find that creating Web Forms is similar to creating traditional Windows applications in Visual Basic.
Session 1 SESSION 1 Working with Dreamweaver 8.0.
Handy separation the report template into pages Handy visual separation of the report template into pages is available in Stimulsoft Reports.Net. You.
- Shourie. 3 Basic Questions What How Why Crystal Reports is a business intelligence application for designing and generating reports from a wide range.
Dr. Azeddine Chikh IS444: Modern tools for applications development.
SQL Reporting Services From a Developers Perspective Adam Calderon Principal Engineer Interknowlogy LLC
Database Handling, Sessions, and AJAX. Post Back ASP.NET Functionality The IsPostBack method in ASP.NET is similar to the BlackBerry.refresh method –IsPostBack.
BlackBerry Applications using Microsoft Visual Studio and Database Handling.
Database Connectivity with ASP.NET. 2 Introduction Web pages commonly used to: –Gather information stored on a Web server database Most server-side scripting.
1 Database Programming with ADO.NET Kashef Mughal.
Chapter 27 Getting “Web-ified” (Web Applications) Clearly Visual Basic: Programming with Visual Basic nd Edition.
Extending SharePoint through Web Parts and ASP.NET 최승현 대리 한국마이크로소프트.
XP New Perspectives on Microsoft Office Access 2003, Second Edition- Tutorial 8 1 Microsoft Office Access 2003 Tutorial 8 – Integrating Access with the.
Module 10: Data Access in ASP.NET. Overview Overview of the ASP.NET Data Access What is Data Access List of Data Source Control What is Data Bound How.
SQL Server Reporting Services for.NET Developers Bret Stateham
Integrating Data Lesson 6.
ASP.NET Programming with C# and SQL Server First Edition
Introduction to Database Processing with ADO.NET
Data Virtualization Demoette… ODBC Clients
Introduction to Database Processing with ADO.NET
SQL Server Reporting Service & Power BI
Lecture 6 VB.Net SQL Server.
ADO.NET Accessing Databases in VS.NET
VISUAL BASIC.
Chapter 10 ADO.
Database Applications
Accessing Databases with ADO.NET, Handling Exceptions, and Printing
Tutorial 7 – Integrating Access With the Web and With Other Programs
Chapter 10 Accessing Database Files
Mark Quirk Head of Technology Developer & Platform Group
Presentation transcript:

.Net Crystal Reports Name: Justin John Date:

Why Use a Reporting Tool? It isn't difficult to retrieve data. You could write code to loop through record sets and print them in your Windows or Web application. In the.NET Framework, you could go further and bind that data to a control, such as a Repeater, Data List or Data Grid. But to present this data in a formal report format is far more complex. Writing code for searching, navigating between pages of the report, zooming the report extent, multiple level totals, charting, conditional formatting, and page-based output are difficult and time-consuming to program. Crystal Reports makes it easy to create and distribute complex reports.

What is Crystal Reports? Crystal reports is the reporting tool of visual studio, an OEM (Original Equipment Manufacturer) of business objects. Crystal Reports has been part of Visual Studio since 1993, and is now the standard for reporting in Visual Studio It ships with every copy of Visual Studio 2005 and is integrated directly into the development environment. Ability to create interactive, presentation-quality content to the windows environment. Create complex and professional reports in a GUI-based program. You can connect your report to almost any database source, as well as to proxy data, such as a result set (for example, an ADO.NET DataSet). With the wizards included in the GUI designer, you can easily set formatting, grouping, charting, and other criteria. You can host your report in either a Web or Windows application

Your reports can be related to your Visual Studio 2005 project in many ways: Embed your reports directly into the project. Access them externally, from a file directory. Access them as a Report Web Service from a remote server.

features An embedded Crystal Reports designer, assisted by wizards and experts, builds complex report files easily.. Data and.NET Dataset connections use the Database Expert to easily interact with a wide variety of database protocols, as well as proxy data in the form of ADO.NET Datasets.. A Crystal Reports SDK interacts with and modifies reports programmatically. Use one of four different object models, each with increasing levels of complexity and power An exporting feature exports data from the Crystal Report Viewer control to Word, Excel, PDF, and HTML, and Crystal Reports formats. The ability to print from the Crystal Report Viewer control enables page-based report printing from any Web or Windows application. Multilingual client support allows you to configure the CrystalReportViewer control so that other languages can be displayed in the Tool Tips, determined by the client browser, the ASPX page, or the environment settings for the machine. Report Web Services, from an ASP.NET Web Service project, allow you to create a project, add a Crystal Report, and publish it as a Web service. Seamless migration is possible from previous versions

Database Connections Crystal Reports for Visual Studio 2005 can connect reports to a wide variety of data sources. The Crystal Reports Designer uses the Database Expert to connect a report to a particular data source. Data connectivity is available through data connections (to databases using database drivers) and proxy data (to an ADO.NET DataSet).

Crystal Reports for Visual Studio 2005 can access and report off the following data sources: Any database with an ODBC driver Any database with an OLEDB Provider Microsoft Access databases Microsoft Excel workbooks ADO.NET datasets ADO.NET datatables ADO recordsets CDO recordsets IDataReader Object Collections DAO recordsets RDO recordsets XML Data in SQL Server 2005 User Defined Types (UDT) in SQL Server 2005

Embedded Crystal Reports Designer Crystal Reports for Visual Studio 2005 comes with an embedded version of the Crystal Reports Designer application that you can run from within Visual Studio The embedded Crystal Reports Designer is a GUI application. Using a collection of wizards and experts, complex report files can be built quickly and easily. Traditionally, the Crystal Reports Designer is a stand-alone application that you launch from your Start menu under the name "Crystal Reports." But in Crystal Reports for Visual Studio 2005, the Crystal Reports Designer is embedded within the application. Report templates are viewed like an ASPX page or.NET class file, within the central window of Visual Studio As a result, the embedded Crystal Reports Designer does not run independently. Instead, it is loaded within Visual Studio 2005 when a report file in Solution Explorer has been double-clicked. The major difference between the stand-alone application and the embedded Crystal Reports is that the menus and toolbars of the embedded Crystal Reports Designer within Visual Studio 2005 are limited, compared to the menus and toolbars that are available in the stand-alone version.

Exporting CrystalReportViewer control Export button formats Adobe Acrobat (.pdf) Crystal Reports (.rpt) Microsoft Excel (.xls) Microsoft Rich Text (.rtf) Microsoft Word (.doc)

Exporting through the API The ReportDocument.Export() method and related exporting methods are provided by the API for programmatic exporting of your report. You can write code to export to any of the export formats listed in the ExportFormatType enum. API export formats Adobe Acrobat (.pdf) Crystal Reports (.rpt) HTML 3.2 and 4.0 (.html) Microsoft Excel (.xls) Microsoft Rich Text (.rtf) Microsoft Word (.doc)

Architecture Three features form the core of the architecture : Embedded Crystal Reports Designer Report Viewer Controls Object Models

Embedded Crystal Reports Designer The embedded Crystal Reports Designer creates or modifies reports. It consists of a graphical user interface for WYSIWYG report design, and a series of experts to simplify data connectivity, sorting, grouping, and other complex report design issues. Crystal Reports Developer includes an enhanced version of the embedded designer that allows you to build powerful reports and reporting applications.

Report Viewer Controls There are two provided controls: The CrystalReportViewer control. This control displays the report in a page-based layout, with the ability to move between pages. The CrystalReportPartsViewer control. The control displays report summary information in a small, portal-like window, with the ability to drill down deeper into the report through a series of linked parts.

Object Models CrystalReportViewer, the simplest object model. ReportDocument, the more extensive object model. Object models available through upgrade: ReportClientDocument, the most extensive object model. InfoObject, a powerful object model for scheduling and configuring reports within the Crystal Reports Server or BusinessObjects Enterprise framework.

CrystalReportViewer The classes of this object model are contained within the CrystalDecisions.Web namespace for the Web Form version of this control or the CrystalDecisions.Windows.Forms namespace for the Windows Form version of this control

Report Document The classes of this object model are contained within the CrystalDecisions.CrystalReports.Engine namespace. This is an extensive set of classes that provide more powerful customization and interaction capability with the report.

ReportClientDocument The classes of this object model are contained within the CrystalDecisions.ReportAppServer group of namespaces

Info Object The classes of this object model are contained within the CrystalDecisions.Enterprise group of namespaces.

Displaying a report using the CrystalReportViewer control The CrystalReportViewer control displays only one report at a time. Which report is displayed by the control is determined by which report you bind to your code. To tell the control which report to display, you bind the ReportSource property of the control to a particular report. At runtime, the control loads the report that is bound to the ReportSource property and displays it. crystalReportViewer1.ReportSource = C:\\WorldSalesReport.rpt"; Demonstrate

The ReportDocument Object Model ReportDocument is a more powerful and more extensive object model than CrystalReportViewer. It ships as part of the Crystal Reports for Visual Studio 2005 SDK and provides extensive ability to manipulate reports in the code.

To bind to an embedded report class that is upcast to ReportDocument Add two additional sample reports to the project: Chart.rpt World Sales Report.rpt Add an "using" [C#] statement to the top of the class for the using CrystalDecisions.CrystalReports.Engine namespace. Using CrystalDecisions.CrystalReports.Engine

Create a private helper method for report selection, as shown below private ReportDocument ChooseReport(int i) { switch(i) { case 1: Chart chartReport = new Chart(); return (ReportDocument) chartReport; case 2: Hierarchical Grouping hierarchicalGroupingReport = new Hierarchical Grouping(); return (ReportDocument) hierarchicalGroupingReport; default: World_Sales_Report worldSalesReport = new World_Sales_Report (); return (ReportDocument) worldSalesReport; }; }

Declare an instance of ReportDocument and populate it by calling the ChooseReport() method, passing in the integer 1 to select the first report, Chart.rpt. ReportDocument reportDocument = ChooseReport(1); This line of code demonstrates how to upcast to the common base class, CrystalReportViewer control. crystalReportViewer.ReportSource = reportDocument;

Bind to a non-embedded report class using the ReportDocument object model using CrystalDecisions.CrystalReports.Engine; Locate the World Sales Report.rpt file string reportPath = "C:\\Program Files\\Microsoft Visual Studio 8\\" + "Crystal Reports\\Samples\\En\\Reports\\General Business\\" + "World Sales Report.rpt"; declare an instance of ReportDocument. ReportDocument reportDocument = new ReportDocument(); Load the non-embedded report class into ReportDocument. reportDocument.Load(reportPath); Assign the ReportDocument instance (which now contains the loaded non- embedded report class) to the ReportSource property of the CrystalReportViewer control. crystalReportViewer.ReportSource = reportDocument;

Manipulating the report using ReportDocument object model Programming the Button Events with Sort Orders Within the event method, retrieve the SortFields property from the DataDefinition property of the report instance and assign it to an instance of the SortFields indexed class SortFields sortFields = hierarchicalGroupingReport.DataDefinition.SortFields; 1. Retrieve the first SortField instance from the SortFields indexed class and assign it to a variable named firstSortField. SortField firstSortField = sortFields[0]; Set the SortDirection property of firstSortField to descending order, by use of the Descending Order selection of the SortDirection enum firstSortField.SortDirection = SortDirection.DescendingOrder; Now re-assign this report (with its sort that has been modified in the ReportDocument object model) to the ReportSource property of the CrystalReportViewer control crystalReportViewer.ReportSource = hierarchicalGroupingReport;

Real-Time scenario : Connecting to ADO.NET DataSets: An ADO.NET Dataset schema provides a template of the data structure in XML. However, a report cannot retrieve data from the Dataset schema alone The Dataset instance must be filled with data, through use of the Data Adapter classes. To begin, you create a data connection and build a Dataset schema that is based on that connection. You then create a helper class with a property that returns a populated instance of the Dataset. Finally, you write code that binds your Crystal report to the Dataset For the Crystal report binding code, you write code to do the following: Instantiate the report. Set its SetDataSource property to the populated Dataset property from the helper class. Bind the populated Crystal report to the CrystalReportViewer control.

Writing a Helper Class to Populate the DataSet The DataSet schema that you have just created for the Customer table is a data structure. At runtime, code is required to populate the DataSet structure with data from the database. In this section, you create a helper class that populates the DataSet with data. using System.Data; using System.Data.OleDb; private const string CONNECTION_STRING = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\\Program Files\\Microsoft Visual Studio 8\\Crystal Reports\\Samples\\Database\\xtreme.mdb"; private const string QUERY_STRING = "SELECT * FROM CUSTOMER"; private const string DATATABLE_NAME = "Customer"; private const string DIRECTORY_FILE_PATH Public static DataSet CustomerDataSet { get { CustomerDataSetSchema dataSet = new CustomerDataSetSchema(); DataSet dataSet = new DataSet(); dataSet.ReadXmlSchema(DIRECTORY_FILE_PATH + "XMLSchema.xsd"); OleDbConnection oleDbConnection = new OleDbConnection(CONNECTION_STRING); OleDbDataAdapter oleDbDataAdapter = new OleDbDataAdapter(QUERY_STRING, oleDbConnection); oleDbDataAdapter.Fill(dataSet, DATATABLE_NAME); return dataSet; }

Creating a Report that Connects to the DataSet Schema In the Create New Crystal Report Document panel of the Crystal Reports Gallery dialog box, select Using a Report Wizard. The Customer report is created, with data connectivity to the CustomerDataSetSchema Binding the Report and Setting the DataSource to the Populated DataSet In this section, you learn how to instantiate the report that you have created, populate the report's DataSet, and display the report in the CrystalReportViewer control. You populate the report through the assignment of its SetDataSource property to the populated DataSet, which is returned from the CustomerDataSet property of the DataSetConfiguration class. Finally, you bind the populated report to the CrystalReportViewer control.

To instantiate and bind an embedded report to the CrystalReportViewer control using System.Data; private Customer customerReport; Within the ConfigureCrystalReports() method, instantiate the report wrapper class. customerReport = new Customer(); On the next line beneath the report instantiation, declare a DataSet. DataSet dataSet; Assign the DataSet instance to the DataSetConfiguration.CustomerDataSet property. dataSet = DataSetConfiguration.CustomerDataSet; Call the SetDataSource() method of the CustomerReport instance and pass into it the customerReport.SetDataSource(dataSet); Bind the ReportSource property of the CrystalReportViewer control to the CustomerReport instance. crystalReportViewer.ReportSource = customerReport;