Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Case Analysis of Visual Studio Crystal report

2025-01-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

Today, I would like to introduce to you the case analysis of Visual Studio Crystal report. The content of the article is good. Now I would like to share it with you. Friends who feel in need can understand it. I hope it will be helpful to you. Let's read it along with the editor's ideas.

There are two methods in the application of Visual Studio Crystal report, namely, pull mode (PULL) and push mode (PUSH).

Pull mode: when the Visual Studio crystal report is generated, the data source is extracted from the SQL statement in the crystal report file from the database, and there is no need to rewrite the SQL statement when programming, but login information should be added (specific method, described later).

Push mode: the data source when the crystal report is generated is the dataset object generated by rewriting the SQL statement in the crystal report when programming. In other words, the push mode is to assemble crystal reports with dataset.

Introduction of Crystal report component. Crystal reports have two components in VS2005, and the WEB project is CrystalReportSource,CrystalReportViewer. In the FORM project, it is crystalReport,CrystalReportViewer.

CrystalReportSource,crystalReport is the data provider for Crystal reports; CrystalReportViewer is the browser for Crystal reports. In addition, I would like to introduce that the report file of water is a file with the extension of rpt, which can be generated by VS2005.

The specific operation methods are described below:

In ◆ pull mode, if you want to add conditional parameters to the SQL statement in the Visual Studio Crystal report, you need to use {? The parameter name} is given. Example: "SELECT T1, T2, T3 FROM T Where T1 parameters'{? parm}'" parm is the parameter name.

◆ the SQL statement used in the crystal report file used in the following example is "SELECT T1, T2, T3 FROM T Where T1 statements'{? parm}'" parm is the parameter name.

Using CrystalDecisions.Shared; using CrystalDecisions.CrystalReports.Engine; protected void Button_pull_Click (object sender, EventArgs e) {/ / CrystalReport.rpt is the name of the crystal report file; CrystalReportSource1 is the crystal report data source object added to the page from the toolbox. CrystalReportSource1.ReportDocument.Load (Server.MapPath ("CrystalReport.rpt")); / / this method must be used to set login information in SetDatabaseLogon pull mode. Parameter 1: user name; Parameter 2: password; Parameter 3: server; Parameter 4: database name CrystalReportSource1.ReportDocument.SetDatabaseLogon ("sa", "123456", @ "SYWZSWL\ SQLEXPRESS", "Test"); / / pass parameters to Crystal report, Parameter 1: parameter name, Parameter 2: parameter value CrystalReportSource1.ReportDocument.SetParameterValue ("Title", "this is a test report"); CrystalReportSource1.ReportDocument.SetParameterValue ("Parm", "1"); / / bind Crystal report data source. CrystalReportSource1.DataBind (); / / CrystalReportViewer1 is the Crystal report browser, the following is assigned to the browser object CrystalReportViewer1.ReportSource = CrystalReportSource1; CrystalReportViewer1.DataBind ();} above is the whole content of Visual Studio Crystal report instance analysis, more content related to Visual Studio Crystal report instance analysis can search the previous articles or browse the following articles to learn ha! I believe the editor will add more knowledge to you. I hope you can support it!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report