简体   繁体   English

我添加到DataSet中的表中的数据未在XtraReport中显示

[英]Data I add to a table in DataSet is not shown in XtraReport

I have a table in my dataset that I create it in dataset design view in Visual Studio 2010. Then in my XtraReport1 class I have some labels that refer to these table columns. 我在数据集中有一个表,该表是在Visual Studio 2010的数据集设计视图中创建的。然后在XtraReport1类中,有一些引用这些表列的标签。 At the beginning this table is empty. 最初,此表为空。 When program is run, this table fill with with data, and then i make a new XtraReport in my code and call .ShowPreviewDialog() for it to show report. 当程序运行时,此表中充满了数据,然后我在代码中创建了一个新的XtraReport并调用.ShowPreviewDialog()使其显示报告。 But it's empty and there is no error. 但是它是空的,没有错误。 Where i don't understanding ? 我不明白的地方?

XtraReport1 report = new XtraReport1();
report.ShowPreviewDialog();

I think when I new up a XtraReport in my code and ShowPreviewDialog , in this specific time XtraReport look at dataset and get its data. ShowPreviewDialog我在代码和ShowPreviewDialog新建一个XtraReport时,在这个特定的时间XtraReport查看数据集并获取其数据。 Am I wrong? 我错了吗? I'm sure that table that XtraReport is using is full with data because I show its data in exact time in a GridView - the GridView has data but the XtraReport doesn't!! 我确定XtraReport使用的表已满数据,因为我在GridView中准确地显示了它的数据-GridView有数据,但XtraReport没有!

Answer is what Davide Piras said in comment : You are not associating the datatable to the report object. 答案是Davide Piras在评论中说的:您没有将数据表与报表对象相关联。 before calling the showpreview assign it to the report datasource 在调用showpreview之前,将其分配给报表数据源

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM