如何使用Asp.net(EF)将Crystal Report导出为PDF

时间:2017-09-13 09:30:06

标签: asp.net crystal-reports export-to-pdf

protected void DOPrintButton_Click(object sender, EventArgs e)
{

    ReportDocument reportdocument = new ReportDocument();
    ParameterField paramField = new ParameterField();
    ParameterFields paramFields = new ParameterFields();
    ParameterDiscreteValue paramDiscreteValue = new ParameterDiscreteValue();
    paramField.Name = "@GatePass";
    paramDiscreteValue.Value = GPLabel.Text;
    paramField.CurrentValues.Add(paramDiscreteValue);
    paramFields.Add(paramField);
    CrystalReportViewer1.ParameterFieldInfo = paramFields;
    reportdocument.Load(Server.MapPath("~/DO_Report.rpt"));
    CrystalReportViewer1.ReportSource = reportdocument;
    CrystalReportViewer1.DataBind();
    reportdocument.Refresh();
    reportdocument.SetDatabaseLogon("sa", "Admin1");     
    reportdocument.ExportToHttpResponse(ExportFormatType.PortableDocFormat,Response,true,"Report");
    Response.End();
}

请帮忙????? 此代码错误"缺少参数值" 救命...........? 我想将水晶报告导出为PDF格式,但我尝试了很多代码。

0 个答案:

没有答案