【发布时间】:2018-11-01 16:59:34
【问题描述】:
我可以访问有支付表的数据库。我正在使用 c# 中的适配器加载此表,并填充一个数据集以用作 RDLC 交叉表报告的数据源。结果符合预期。但我的问题是,在添加更多数据时,报告并没有显示未来可能出现的所有列。
我的问题是,即使没有数据,如何指定要在 RDLC 交叉表报告中显示的所有必需列?
这是我的基本代码:
string sql = "select* from [payments]";
try
{
using (OleDbConnection conn = new OleDbConnection(myGlobals.connString))
{
using (OleDbDataAdapter adapter = new OleDbDataAdapter(sql, conn))
{
DataSet ds = new DataSet();
adapter.Fill(ds, "regPayments");
frmReport report = new frmReport();
BindingSource bs = new BindingSource(ds, "regPayments");
report.ReportViewer.LocalReport.DataSources.Add(new ReportDataSource("dsRegPayments", bs));
report.ReportViewer.LocalReport.ReportEmbeddedResource = "Kindergarten.Report10.rdlc";
report.Show();
}
}
}
catch(Exception ex)
{
MessageBox.Show(ex.ToString());
}
【问题讨论】:
-
能否请您发布您所谈论内容的屏幕截图,并详细说明您所说的“报告未显示未来可能出现的所有可能列”的意思?您是在谈论有人向 Access 表添加列并让报告自动选择它们吗?
-
我的意思是,例如,1 月、2 月和 3 月存在一些付款。但在我的交叉表中,我需要显示所有 12 个月,即使那几个月没有付款
标签: c# static report rdlc crosstab