【问题标题】:Generate report based on search asp.net基于搜索asp.net生成报告
【发布时间】:2014-04-10 17:25:13
【问题描述】:

目前我正在学习如何使用 asp.net 生成报告。我希望生成显示在网格视图上的结果以在搜索后报告。

我在报告查看器按钮上试过这个,但它不起作用。

Protected Sub Button1_Click(sender As Object, e As System.EventArgs) Handles Button1.Click

    ReportViewer1.Reset()

    Dim rptSrc As New ReportDataSource("DataSet1", GetData())
    ReportViewer1.LocalReport.DataSources.Add(rptSrc)
    ReportViewer1.LocalReport.ReportPath = "Report.rdlc"

    ReportViewer1.LocalReport.Refresh()

End Sub

谁能推荐一个关于基于搜索生成报告的教程或者谁可以提供代码?谢谢。

【问题讨论】:

    标签: asp.net reportviewer


    【解决方案1】:

    点击方法使用此代码

    String query = Select * from members where member_id=""+txtProductID.Text; OleDbCommand cmd = new OleDbCommand(query, sCon); OleDbDataAdapter oda = new OleDbDataAdapter(cmd); sCon.Open(); oda.Fill(imageDataSet.Tables["DataTable1"]); sCon.Close();

        //Set Report Source
        ReportDocument crystalReport = new ReportDocument();
        crystalReport.Load(Server.MapPath("CrystalReport.rpt"));
        crystalReport.SetDataSource(imageDataSet);
        CrystalReportViewer1.ReportSource = crystalReport;
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多