【发布时间】: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);
}
}
【问题讨论】: