我正在尝试从代码加载我的ASP.NET报表查看器,出现以下错误 A data source instance has not been supplied for the data source
这是我的代码:
Class_Connection.cnn.Close();
Class_Connection.cnn.Open();
var cmd = new SqlCommand("select * from TT", Class_Connection.cnn);
var dt = new DataTable();
dt.Load(cmd.ExecuteReader());
var source = new ReportDataSource(dt.TableName, dt);
RV_Main.LocalReport.DataSources.Clear();
RV_Main.LocalReport.ReportPath = Server.MapPath("~/Reports/AllTTByLastWeek.rdlc");
RV_Main.LocalReport.DataSources.Add(source);
RV_Main.LocalReport.Refresh();
如何从不在GUI控件中的代码提供数据源实例?
我必须在IDE中通过GUI在属性中设置数据源。即使我在后面的代码中进行设置,也无法解决问题。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句