RDLC报告没有显示报告
本文关键字:报告 显示 RDLC | 更新日期: 2023-09-27 17:53:25
我正在显示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);
}
}
假设您使用的是Visual Studio -我认为您的问题将通过在解决方案资源管理器中右键单击报告并进入属性来解决。
在属性中将构建操作更改为Embedded Resource
并再次运行项目