我正在填写DataTable表单访问数据库。当执行来到" adapter.Fill(table)"它跳转到mdi表格并向我显示空表格。我不知道该怎么办?以下是我的代码。在此先感谢。
private void Attendence_Report_Load(object sender, EventArgs e)
{
OleDbConnection con = new OleDbConnection(@"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=D:\farman C# project\next.accdb");
OleDbCommand com = new OleDbCommand();
OleDbDataAdapter adapter = new OleDbDataAdapter();
DataTable table = new System.Data.DataTable();
com.CommandText = "SELECT Student.SName, Student.FatherName, Class.ClassName AS Class, `Section`.SectoinName AS `Section`, Attendance.Attendance, Attendance.Date AS `Date` FROM " +
"((Attendance INNER JOIN Student ON Attendance.StudentID = Student.ID) INNER JOIN Class ON Attendance.ClassID = Class.ID) INNER JOIN `Section` ON Attendance.SectionID = `Section`.ID";
com.Connection = con;
con.Open();
adapter.SelectCommand = com;
adapter.Fill(table);
con.Close();
reportViewer1.LocalReport.ReportEmbeddedResource = "Attendence.Attendence_Report.rdlc";
ReportDataSource source = new ReportDataSource("DataSet1", table);
reportViewer1.LocalReport.DataSources.Clear();
reportViewer1.LocalReport.DataSources.Add(source);
reportViewer1.RefreshReport();
}