How to export Crystal Report to PDF using Asp.net (EF)

249 Views Asked by At
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();
}

please help????? this code error "Missing parameter value" help...........? i want to export crystal report to PDF format , but i tried many codes .

0

There are 0 best solutions below