水晶报表动态代码加载报表示例如下:
try
{
DataTable dt = new DataTable();
--Load Data From DB
//从数据库加载数据忽略
ReportDocument rDoc = new ReportDocument();
TableLogOnInfo info = new TableLogOnInfo();
string path = Application.StartupPath + @"\Reprots\***.rpt";
rDoc.Load(path);
rDoc.Database.Tables[0].ApplyLogOnInfo(info);
rDoc.Database.Tables[0].SetDataSource(dt);
this.rptView.ReportSource = rDoc;
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
浙公网安备 33010602011771号