【问题标题】:Creating Report With Report Viewer Using Mysql and C#使用 Mysql 和 C# 使用报表查看器创建报表
【发布时间】:2013-10-22 07:54:08
【问题描述】:

在使用带有 mysql 数据库的 c# 中的数据集查看报告时遇到问题,我使用编程代码创建它。我在互联网上尝试了很多文章,但我的报告仍然没有显示。是否可以使用 C# 和 MySQL 使用报表查看器创建报表?

这是我的代码

private void reporttest_Load(object sender, EventArgs e)
    {
        string comm = "select * from t_pejabat";
        MySqlConnection conn = new MySqlConnection(Program.konek);
        MySqlCommand comd = new MySqlCommand(comm, conn);
        conn.Open();
        DataSet1 ds = new DataSet1();
        MySqlDataAdapter da = new MySqlDataAdapter(comd);
        da.Fill(ds, "isi");
        conn.Close();


        this.reportViewer1.Reset();
        this.reportViewer1.LocalReport.DataSources.Add(new ReportDataSource("isi", ds.Tables[0]));
        this.reportViewer1.RefreshReport();
    }

这是错误图片 error

【问题讨论】:

  • 你能贴出你的代码sn-p....
  • 您能否提供更多详细信息,例如报告类型?是 SSRS 还是 Crystal Reports?
  • 我正在使用包含在 vs 2010 中的数据报告
  • 任何错误信息?如果不提供更多详细信息,现在没有人可以回答您的问题...

标签: c# mysql winforms reportviewer


【解决方案1】:

通常出现此错误是因为未设置reportViewer1.LocalReport.ReportPath

您可以通过代码或使用表单设计器来完成。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-06-25
    • 1970-01-01
    • 1970-01-01
    • 2014-06-14
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多