c# - 如何使用编码运行 rdlc

标签 c# crystal-reports dataset reporting rdlc

我创建了一个 rdlc,我在其中使用数据集作为解决方案资源管理器中的新项目来设计我的报告。从名为 Dataset1datasource 绑定(bind)我的报告后。我已经创建了它的对象并尝试使用编码填充此 datasource。现在,当我运行以下代码时,我没有得到任何结果。

可能是什么问题?

reportViewer1.ProcessingMode = Microsoft.Reporting.WinForms.ProcessingMode.Local;
LocalReport localReport = reportViewer1.LocalReport;
localReport.DataSources.Clear();
localReport.ReportPath = @"E:\Projects\Manojp\AARFID_SSRS_Report\WindowsFormsApplication1\WindowsFormsApplication1\Local Report\rptTest.rdlc";

// DataSet dataset = new DataSet("AARFID_Report");
DataSet1 ds = new DataSet1();

// fill the Data Set from DataBase.
//ds.Tables.Remove("M_GUEST");
ds.Tables.Clear();
GetData(ref ds);

//
// Create a report data source for the sales order data

ReportDataSource rds = new ReportDataSource();
rds.Name = "AA";
rds.Value = ds.Tables[0];
localReport.DataSources.Add(rds); 
// reportViewer1.LocalReport.DataSources.Add(rds); 


reportViewer1.RefreshReport();
localReport.DataSources.Clear();

GetData() 这样做:

connection.Open();
ad.Fill(ds,"M_GUEST");
connection.Close();

在报告 View 中,消息显示为:

A data source instance has not been supplied for the data source 'dtaset1_m_guest'

最佳答案

确保 rdl 文件中的数据集名称与报告生成器匹配!

最简单的方法是拥有一个数据集、数据源和名为“M_GUEST”的实例。另外,不要在渲染前清除数据源。

关于c# - 如何使用编码运行 rdlc,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3147252/

相关文章:

c# - 将文件转换为 utf-8 但字符被破坏

c# - 如何将参数传递给 Visual Studio 2010 的 Crystal Report?看起来他们被忽略了

crystal-reports - 是否有创建 Crystal 报表的 api

vb.net - 在一个数据 GridView 中显示父数据表并在另一个数据 GridView 中显示子数据表元素?

postgresql - 如何从PostgreSQL 9.0函数中获取数据集("stored procedure")

c# - 使用 MVC SimpleMembership 分配角色

c# - 如何避免文件阻塞

c# - PdfReader 未打开,iText 中出现所有者密码错误

.net - 我的代码中出现未知数据库连接器错误

python - 使用 4300 万行文本文件中的计数创建字典的更简单方法是什么?