将Crystal报表导出为PDF

时间:2013-10-29 15:46:45

标签: c# asp.net crystal-reports

我在SAP的asp.net(C#)4.0,Crystal Report 13中成功创建了Crystal Report文档,但问题是单击导出按钮后,它既不打印也不打印,为什么?

enter image description here

代码:

protected void Page_Load(object sender, EventArgs e)
{
    if (!IsPostBack) 
    {
        Dataset_load();
    }
}

protected void Dataset_load() 
{
    SqlConnection sqlcon = new SqlConnection(conStr);
    SqlCommand sqlCom = new SqlCommand("select * from Login", sqlcon);
    SqlDataAdapter sqlDA = new SqlDataAdapter(sqlCom);
   // DataSet ds = new DataSet("CRDataSet");

    try
    {
        sqlcon.Open();
        //sqlCom.ExecuteNonQuery();
        //sqlDA.Fill(ds,"Login");

        DataSet1 ds = new DataSet1();
        DataTable dt = new DataTable("DT_CR");
        sqlDA.Fill(dt);
        ds.Tables[0].Merge(dt);
        ReportDocument rd = new ReportDocument();
        rd.Load(Server.MapPath("CrystalReport.rpt"));
        rd.SetDataSource(ds);
        CrystalReportViewer1.ReportSource = rd;


    }
    catch (Exception exc)
    {
        Response.Write(exc.Message);
    }
    finally 
    {
        sqlcon.Close();
    }

1 个答案:

答案 0 :(得分:0)

检查以确保您的浏览器没有启用弹出窗口阻止程序。