Small Sample Crystal Report for learning

Source: Internet
Author: User

First of all, this is not a very advanced compilation.ArticleIt indicates learning.

What is Crystal Reports?

Crystal Reports has been part of Visual Studio since 1993 and has now become a standard report creation tool in Visual Studio 2005. This tool is attached to each Visual Studio 2005 and is directly integrated into the development environment.

Use Crystal Reports for Visual Studio 2005 to create interactive content that meets the demo quality in a Windows environment. Use Crystal Reports for Visual Studio 2005ProgramCreate complex and professional reports. Then, you can connect a report to almost all data sources and proxy data, such as a result set (for example, An ADO. Net dataset ). The wizard that comes with the GUI designer allows you to easily set formatting, grouping, chart creation, and other conditions.

By using one of the Crystal Reports for Visual Studio 2005 viewer controls, you can host reports in web or Windows applications. Reports displayed on Windows clients and HTML 3.2 or 4.0 clients are highly interactive and provide functions such as deepening charts, report navigation, and text search.(From msdn)

Well, I can't say anything nonsense. Let's look at the example below (vs2008)

1. winform CRYSTAL REPORT

A. Create a project ()

B. Add a dataset file dataset1.xsd to this project.

 

C. Add a report file crystalreport1.rpt

 

D. Add a crystalreportviewer1 control to the form.

E. Write as bindingCode

Dataset DS= NewDataset ();

  Using (Sqlconnection con =   New Sqlconnection ( " Server =.; database = usersinfro; uid = sa; Pwd = sa123; " ))
{
Sqlcommand cmd =   New Sqlcommand ( " Select * From usermsg " , Con );
Sqldataadapter da =   New Sqldataadapter ();
Da. selectcommand = CMD;
Con. open ();
Da. Fill (DS );
}
Crystalreport1 cr =   New Crystalreport1 ();
Cr. setdatasource (Ds. Tables [ 0 ]);
Crystalreportviewer1.reportsource = CR;

 

F. Check the running results.

Here is a simple example to get started

Note that there is a difference between the Web crystal report and winform. The former needs to be sent back when the next page is clicked.

 

   

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.