本地报表处理时如何设置报表的文件路径
private void btnReport_Click(object sender, RoutedEventArgs e)
{
try
{
if (!_isReportViewerLoaded)
{
Tbl_SensorDataSet 是一个具有 Tbl_SensorDataSetTableadapter 的数据集
Microsoft.Reporting.WinForms.ReportDataSource reportDataSource1;
Tbl_SensorDataSet dataset;
string query = Reportingquery;
dataset = new Tbl_SensorDataSet();
reportDataSource1 = new Microsoft.Reporting.WinForms.ReportDataSource();
Tbl_SensorDataSetTableAdapters.GetFilterReadingTableAdapter TableAdapter1 = new Tbl_SensorDataSetTableAdapters.GetFilterReadingTableAdapter();
TableAdapter1.ClearBeforeFill = true;
TableAdapter1.Fill(dataset.GetFilterReading, query);
dataset.BeginInit();
reportDataSource1.Name = "DataSet1";
reportDataSource1.Value = dataset.GetFilterReading;
this._reportViewer.LocalReport.DataSources.Add(reportDataSource1);
this._reportViewer.LocalReport.ReportPath = "../../SensorReport.rdlc";
dataset.EndInit();
_reportViewer.RefreshReport();
_isReportViewerLoaded = true;
}
}
catch (Exception ex) { throw ex; }
}