Lenka.Guo 发表于 2020-7-2 12:27:01

AR14-WebViewer 绑定运行时数据源报错

AR14 WebViewer 绑定运行时数据源,时候,报表提示No DataSet has been set 这类错误。


Lenka.Guo 发表于 2020-7-2 12:28:47

解决方法:打开 Global.asax.cs, 在这个里面去配置
Sergey Romanov
    in global.asax, you can change the initialization setting to         protected void Application_Start(object sender, EventArgs e)      {
            this.UseReporting(settings =>
            {
                settings.UseFileStore(new DirectoryInfo(Server.MapPath("~")));
                settings.UseCompression = true;
                settings.SetLocateDataSource(args => { return LoadData(); });
            });
      }



示例代码如下:
this.UseReporting(settings =>
            {
                settings.UseFileStore(new DirectoryInfo("~"));
                settings.UseCompression = true;
                settings.SetLocateDataSource(args => {
                  System.Data.DataTable dt = new System.Data.DataTable();
                  if (args.Report.DataSets.Name == "DataSet1")
                  {
                     

                        dt.Columns.Add("Field1");
                        dt.Columns.Add("Field2");
                        dt.Rows.Add("1", "1");
                        dt.Rows.Add("2", "2");
                     
                  }

                  returndt;
                });
               

            });



页: [1]
查看完整版本: AR14-WebViewer 绑定运行时数据源报错