Crystal reports 水晶报告没有';生成时不显示数据

Crystal reports 水晶报告没有';生成时不显示数据,crystal-reports,report,Crystal Reports,Report,当我在运行时生成它时,它不会显示任何数据。但当我查看VS 2010的“主报告预览”时,情况确实如此。我还检查了我的存储过程,当我执行它时,它确实会生成数据。有什么问题吗 这是我在加载页面中的代码: protected void Page_Load(object sender, EventArgs e) { string municipio = Request.QueryString["municipio"]; string ano = Request.Qu

当我在运行时生成它时,它不会显示任何数据。但当我查看VS 2010的“主报告预览”时,情况确实如此。我还检查了我的存储过程,当我执行它时,它确实会生成数据。有什么问题吗

这是我在加载页面中的代码:

protected void Page_Load(object sender, EventArgs e)
    {
        string municipio = Request.QueryString["municipio"];
        string ano = Request.QueryString["ano"];
        string cnpj = Server.UrlDecode(Request.QueryString["cnpj"]);

        DataTable dt;

        string CS = ConfigurationManager.ConnectionStrings["DBCS"].ConnectionString;

        using (SqlConnection cnn = new SqlConnection(CS))
        {

            cnn.Open();
            //stored procedure 
            SqlCommand cmd = new SqlCommand("spConsultaRelatorioCompleto", cnn);

                cmd.CommandType = System.Data.CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@ano", ano);
                cmd.Parameters.AddWithValue("@municipio", municipio);
                cmd.Parameters.AddWithValue("@cnpj", cnpj);

                //read access to the database
                SqlDataReader dr = cmd.ExecuteReader();

                SqlDataAdapter da = new SqlDataAdapter(cmd);

                    //datatable with data
                    dt = new DataTable("dt");

                    //datatable with datareader's data
                    dt.Load(dr);
                    da.Fill(dt);


        }

        ReportDocument MeuRelatorio = new ReportDocument();
        MeuRelatorio.Load(Server.MapPath("RelatorioConvenio.rpt"));
        MeuRelatorio.SetDataSource(dt);
        CrystalReportViewer1.ReportSource = MeuRelatorio;




    }



}
}

单击下面的按钮时,我在另一个Web表单中给出了一些值:

protected void btnExport_Click(object sender, EventArgs e)
    {
        Response.Redirect("RelatorioGerado.aspx?municipio=" + ddlmunicipioconvenente.Text + "&cnpj=" + Server.UrlEncode(tbcnpjconvenente.Text) + "&ano=" + tbAno.Text);

    }    

当您跟踪时,它是由DB中的值填充的dt??是,dt是由DB中的值填充的尝试使用http响应导出它吗?它至少起作用了吗?而且充满了数据。