. Net (C #) calls Crystal Reports that use Extract mode to get data

Source: Internet
Author: User
Tags split
Data | Crystal report using System;
Using System.Drawing;
Using System.Collections;
Using System.ComponentModel;
Using System.Windows.Forms;
Using CrystalDecisions.CrystalReports.Engine;
Using Crystaldecisions.shared;
Namespace Dllcrystal
{
<summary>
Summary description of the Frmcrystalview.
</summary>
Internal class FrmCrystalView:System.Windows.Forms.Form
{
Private CrystalDecisions.Windows.Forms.CrystalReportViewer Crview;
<summary>
The required designer variable.
</summary>
Private System.ComponentModel.Container components = null;
Private string[] Strinfo;

Public Frmcrystalview (string[] strinfomation)
{
//
Required for Windows Forms Designer support
//
InitializeComponent ();

//
TODO: Add any constructor code after the InitializeComponent call
//
Strinfo=strinfomation;
}

<summary>
Clean up all resources that are in use.
</summary>
protected override void Dispose (bool disposing)
{
if (disposing)
{
if (Components!= null)
{
Components. Dispose ();
}
}
Base. Dispose (disposing);
}

Code generated #region the Windows forms Designer
<summary>
Designer supports required methods-do not use the Code editor to modify
The contents of this method.
</summary>
private void InitializeComponent ()
{
This.crview = new CrystalDecisions.Windows.Forms.CrystalReportViewer ();
This. SuspendLayout ();
//
Crview
//
This.crView.ActiveViewIndex =-1;
This.crView.Dock = System.Windows.Forms.DockStyle.Fill;
This.crView.Location = new System.Drawing.Point (0, 0);
This.crView.Name = "Crview";
This.crView.ReportSource = null;
This.crView.ShowRefreshButton = false;
This.crView.Size = new System.Drawing.Size (640, 509);
This.crView.TabIndex = 0;
//
Frmcrystalview
//
This. AutoScaleBaseSize = new System.Drawing.Size (6, 14);
This. ClientSize = new System.Drawing.Size (640, 509);
This. Controls.Add (This.crview);
This. Name = "Frmcrystalview";
This. Text = "Preview Report";
This. Load + = new System.EventHandler (this.frmcrystalview_load);
This. ResumeLayout (FALSE);

}
#endregion

private void Frmcrystalview_load (object sender, System.EventArgs e)
{
Reportdocument rdview=new reportdocument ();
Rdview.load (@strInfo [0]);
foreach (Table tbview in RdView.Database.Tables)
{
TableLogOnInfo tliview=new tablelogoninfo ();
Tliview=tbview.logoninfo;
TLIVIEW.CONNECTIONINFO.SERVERNAME=STRINFO[1];
TLIVIEW.CONNECTIONINFO.DATABASENAME=STRINFO[2];
TLIVIEW.CONNECTIONINFO.USERID=STRINFO[3];
TLIVIEW.CONNECTIONINFO.PASSWORD=STRINFO[4];
Tbview.applylogoninfo (Tliview);
}

string [] strparameter=strinfo[5]. Split (new char[] {' + '});
for (int i=0;i<strparameter.length;i++)
{
string [] strsubparam=strparameter[i]. Split (new char[] {' = '});
ParameterValues pvvalue=new parametervalues ();
Parameterdiscretevalue pdvvalue=new Parameterdiscretevalue ();
PDVVALUE.VALUE=STRSUBPARAM[1];
Pvvalue.add (Pdvvalue);
Rdview.datadefinition.parameterfields[strsubparam[0]]. Applycurrentvalues (Pvvalue);
}
Crview.reportsource=rdview;
This. Location = new Point (0, 0);
This. Size = new System.Drawing.Size (1024,744);
}
}
}





Related Article

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.