【问题标题】:rdlc report not showing the reportrdlc 报告未显示报告
【发布时间】:2015-06-04 12:34:04
【问题描述】:

我正在显示 rdlc 报告,但它给了我错误(未指定“RptAttendence.rdlc”报告的报告定义)。这是我的代码我做错了什么?提前致谢。

private void RptAttendence_Load(object sender, EventArgs e)
        {
            try
            {
                OleDbConnection con = new OleDbConnection(@"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\jani\Documents\saloo.accdb");
                OleDbCommand cmd = new OleDbCommand();
                cmd.CommandText = "SELECT Student.Name, Student.FName,Class.Name As Class, [Section].Name As [Section], Attendence.Attendence, Attendence.Dat As [Date] From " +
                    "(((Attendence Inner join Student on Attendence.StudentID =Student.ID) inner join Class on Attendence.ClassID= Class.ID) inner join [Section] ON Attendence.SectionID = [Section].ID)";
                OleDbDataAdapter adapter = new OleDbDataAdapter();
                DataTable table = new DataTable();
                cmd.Connection = con;
                con.Open();
                adapter.SelectCommand = cmd;
                adapter.Fill(table);

                reportViewer1.LocalReport.ReportEmbeddedResource = "Attendence.RptAttendence.rdlc";

                ReportDataSource source = new ReportDataSource("Dataset1", table);
                reportViewer1.LocalReport.DataSources.Clear();
                reportViewer1.LocalReport.DataSources.Add(source);
                reportViewer1.LocalReport.Refresh();
                this.reportViewer1.RefreshReport();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

【问题讨论】:

    标签: c# winforms report rdlc


    【解决方案1】:

    假设您使用的是 Visual Studio - 我认为您的问题将通过在解决方案资源管理器中右键单击您的报告并进入属性来解决。

    在属性中将构建操作更改为Embedded Resource 并再次运行您的项目

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2015-08-04
      • 1970-01-01
      • 2014-10-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多