方法一:
建数据源,数据集,在ReportViewer里简单设置下就可以运行了.
方法二:
把上图的Data Source Instance都设置为none,
在后台添加如下代码,
private void Form1_Load(object sender, EventArgs e)
{
string ss = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Documents and Settings\AXzhz\My Documents\Visual Studio 2005\Projects\AX\WindowsApplication10\WindowsApplication10\DataBase1.mdb;Persist Security Info=False";
OleDbConnection con = new OleDbConnection(ss);
OleDbDataAdapter da = new OleDbDataAdapter("Select * from Table1", con);
OleDbDataAdapter da1 = new OleDbDataAdapter("Select * from Table2", con);
DataSet ds = new DataSet();
da.Fill(ds, "Table1");
da1.Fill(ds,"Table2");
this.reportViewer1.LocalReport.DataSources.Add(new ReportDataSource("DS_Table1", ds.Tables[0]));
this.reportViewer1.LocalReport.DataSources.Add(new ReportDataSource("DS_Table2", ds.Tables[1]));
this.reportViewer1.LocalReport.ReportEmbeddedResource="WindowsApplication10.Report1.rdlc";
this.reportViewer1.RefreshReport();
}