您的位置:首页 > 其它

[水晶报表]PUSH与PULL模式

2016-08-17 11:03 387 查看
HTML:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="PurInvoiceRpt.aspx.cs" Inherits="DzPlatForm.ERP.FIN.PurInvoiceRpt" %>

<%@ Register assembly="CrystalDecisions.Web, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304" namespace="CrystalDecisions.Web" tagprefix="CR" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<CR:CrystalReportViewer ID="CrystalReportViewer1" runat="server"
AutoDataBind="True" GroupTreeImagesFolderUrl="" Height="50px"
ReportSourceID="CrystalReportSource1" ToolbarImagesFolderUrl=""
ToolPanelWidth="200px" Width="903px" ToolPanelView="None"  />
<CR:CrystalReportSource ID="CrystalReportSource1" runat="server">
<%--            <Report FileName="..\..\Report\PurInvoice.rpt">
</Report>--%>
</CR:CrystalReportSource>

</form>
</body>
</html>


CS:

DataSet ds = new DataSet();
ds = SqlHelper.ExecuteDataset(db.StringConnection(), CommandType.StoredProcedure, "DZ_PurInvoice", parms);
//push 推模式
if (ds != null)
{

CrystalDecisions.CrystalReports.Engine.ReportDocument doc = new CrystalDecisions.CrystalReports.Engine.ReportDocument();
string reportPath = Server.MapPath("..\\..\\Report\\PurInvoice.rpt");
doc.Load(reportPath);
doc.SetDataSource(ds.Tables[0].DefaultView);
CrystalReportViewer1.Width = 1200;
CrystalReportViewer1.ID = TA001+TA002;
CrystalReportViewer1.ReportSource = doc;

}
else
{
JScript.Alert("没有找到记录", this.Page);
}

//pull 拉模式
//CrystalReportSource1.ReportDocument.SetDatabaseLogon("sa", "Supper99", "192.168.1.99", "ZM");
//CrystalReportSource1.ReportDocument.SetParameterValue("@TA001", TA001);
//CrystalReportSource1.ReportDocument.SetParameterValue("@TA002", TA002);
//CrystalReportSource1.DataBind();
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: