欢迎光临
我们一直在努力

.Net(c#)调用采用“提取模式”获取数据的水晶报表-.NET教程,报表/图形/Office

建站超值云服务器,限时71元/月

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>

/// frmcrystalview 的摘要说明。

/// </summary>

internal class frmcrystalview : system.windows.forms.form

{

private crystaldecisions.windows.forms.crystalreportviewer crview;

/// <summary>

/// 必需的设计器变量。

/// </summary>

private system.componentmodel.container components = null;

private string[] strinfo;

public frmcrystalview(string[] strinfomation)

{

//

// windows 窗体设计器支持所必需的

//

initializecomponent();

//

// todo: 在 initializecomponent 调用后添加任何构造函数代码

//

strinfo=strinfomation;

}

/// <summary>

/// 清理所有正在使用的资源。

/// </summary>

protected override void dispose( bool disposing )

{

if( disposing )

{

if(components != null)

{

components.dispose();

}

}

base.dispose( disposing );

}

#region windows 窗体设计器生成的代码

/// <summary>

/// 设计器支持所需的方法 – 不要使用代码编辑器修改

/// 此方法的内容。

/// </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 = "预览报表";

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);

}

}

}

赞(0)
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com 特别注意:本站所有转载文章言论不代表本站观点! 本站所提供的图片等素材,版权归原作者所有,如需使用,请与原作者联系。未经允许不得转载:IDC资讯中心 » .Net(c#)调用采用“提取模式”获取数据的水晶报表-.NET教程,报表/图形/Office
分享到: 更多 (0)

相关推荐

  • 暂无文章