回复 8楼dof的帖子
- PageReport report = new PageReport();
- report.Load(new FileInfo(Server.MapPath(@"~/TestPageReport.rdlx")));
- DataSource mydataSource = new DataSource();
- mydataSource.Name = "MyDataSource";
- mydataSource.ConnectionProperties.DataProvider = "Object";
- mydataSource.ConnectionProperties.ConnectString = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=E:\MVC学习\MyReportsDemo\MyReportsDemo\Reels.mdb";
- DataSet MydataSet = new DataSet();
- MydataSet.Name = "MyDataSet";
- Query query = new Query();
- query.DataSourceName = "MyDataSource";
- query.CommandType = QueryCommandType.Text;
- query.CommandText = "select top 9 * from Employee";
- MydataSet.Query = query;
- Field _field = new Field("employeeID", "employeeID", null);
- MydataSet.Fields.Add(_field);
- _field = new Field("Salary", "Salary", null);
- MydataSet.Fields.Add(_field);
- _field = new Field("StartDate", "StartDate", null);
- MydataSet.Fields.Add(_field);
- _field = new Field("EndDate", "EndDate", null);
- MydataSet.Fields.Add(_field);
- _field = new Field("Interests", "Interests", null);
- MydataSet.Fields.Add(_field);
- report.Report.ReportParameters[0].DefaultValue.Values.Add("我的参数");
- report.Report.ReportParameters[1].DefaultValue.Values.Add("测试参数");
- report.Report.DataSources.Add(mydataSource);
- report.Report.DataSets.Add(MydataSet);
-
- report.Run();
- WebViewer.Report = report;
复制代码
我想写成LIST类型的数据,试了好多次都不成功。麻烦您帮我调试一下。 |