rdlc报告未显示该报告

时间:2015-06-04 12:34:04

标签: c# winforms report rdlc

我正在显示rdlc报告,但它给了我错误(&#34的报告定义; RptAttendence.rdlc"未指定报告)。这是我的代码我用它做什么wron?提前谢谢。

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);
            }
        }

1 个答案:

答案 0 :(得分:0)

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

在属性中,将构建操作更改为JSON.parse()并再次运行项目