.Net(c#)调用采用“提取模式”获取数据的水晶报表

数据|水晶报表

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

时间: 2024-08-03 13:36:18

.Net(c#)调用采用“提取模式”获取数据的水晶报表的相关文章

没有数据-C#水晶报表不显示数据?

问题描述 C#水晶报表不显示数据? 数据库是sqlite,代码如下,什么推模式拉模式的不懂呀.. SQLiteConnection conn = new SQLiteConnection("Data Source=equipment.db"); conn.Open(); SQLiteCommand comm = new SQLiteCommand("select eqName,model,danwei,count,price,total from storeA",

如何用将DataGridView中显示数据加进水晶报表

问题描述 小弟是新手!教科书上有写怎么建立水晶报表,加载SQL数据库中的表(我用的是SQL数据库).但是我需要的是水晶报表加载DataGridView上显示的值.比如我的管理系统有个查询功能,我查询的数据会显示在DataGridView上,然后我想点击一个button按钮,打开另一个窗体,将当前的DataGridView上的数据加载进水晶报表.别的过程我都可以慢慢摸索,主要是怎么把DataGridView上数据加载进水晶报表这里我完全不懂.求大神相助啊!详细点啊!我可以加分加分加分! 解决方案

winform 水晶报表如何绑定数据

问题描述 绑定自己查询出来的结果如何做到?如何隐藏水晶报表的Box 解决方案 解决方案二:在报表控件中设置datasource和Dataset,datasource中设置connectionstring,dataset中设置sql语句,将数据库返回结果绑定报表就好解决方案三:动态绑定水晶报表示例一.加载信息//显示所有学生信息privatevoidForm1_Load(objectsender,EventArgse){stringP_str_sql=//创建公式字符串"{tb_StudentIn

水晶报表显示后,修改水晶报表中的数据

问题描述 水晶报表显示后,修改水晶报表中的数据或者水晶报表中的文本对象赋值后,然后在修改水晶报表中文本对象的值 解决方案 解决方案二: 解决方案三:你这个好像没用我都看过

【求助】EJB调用接口获取数据

问题描述 需求:别人给了我一份word文档,根据文档中提供的内容,获取数据信息.文档内容(隐私内容用XXX表示):一服务器配置.IP地址:XXX.XXX.XXX.XXX网络服务器:weblogic采用技术:数据调用采用EJB技术二调用方式.加载lib文件夹里的2个jar文件调用方式可为cn.com.wavenet.util.WiskUtil里的方法readRealDateWisk返回最新的潮位,气象数据,潮流数据(流速流向.含沙量.含盐度.水温.浮标偏移)readSeriesDateWisk读取

解决php使用异步调用获取数据时出现(错误c00ce56e导致此项操作无法完成)

本篇文章是对php中使用异步调用获取数据时出现(由于出现错误c00ce56e而导致此项操作无法完成)的解决方法进行了详细的分析介绍,需要的朋友参考下   [详细错误]:由于出现错误 c00ce56e 而导致此项操作无法完成 [造成原因]:未指定输出编码格式. [解决办法]:句首加入header("content-type:text/html; charset=UTF-8");  

c++-C++调用exe文件并获取其中的数据

问题描述 C++调用exe文件并获取其中的数据 利用C++调用DelPhi的.exe程序,要求可以通过.exe文件获取一些值, 并且可以执行一些操作,比如触发一些按钮点击事件, 我是有Delphi源代码的. 解决方案 C++调用exe文件C++调用exe文件 解决方案二: 进程通信,比如文件,socket,共享内存等方式

java web cgi 返回值-Java web 调用cgi发送form表达数据,如何获取返回值?

问题描述 Java web 调用cgi发送form表达数据,如何获取返回值? 各位,大家好,有个问题想请教一下,目前一套java web开发的网站,需要调用外公司 提供的一个cgi接口,用于实现发送一个字符串(包含了几个字段的数据)给他们的cgi 脚本,我们发送不论成功或者失败,他们都会返回一个具体的int值给我们,我该如何发 送并获取返回值?网上看到的资料不是特别多,自己大概的思路如下: //jsp要调用的程序为AgentRetMaintainerAct.cgi URL u = new URL

fgets-popen调用后,从执行的shell命令结果中获取数据失败

问题描述 popen调用后,从执行的shell命令结果中获取数据失败 #include #include #include #include #define CMD "cat /proc/diskstats| grep 'b[sh]d[a-z]b'| awk '{print $4" "$6" "$8" "$10}'" int main() { FILE *file=popen(CMD, "r"); char