本文介绍了报表查看器不显示嵌入式.RDLC报表中的选定字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好:



虽然我很擅长在WinForm应用程序中使用嵌入式报表(.rdlc)(在C#中),但我想我理解基本概念。我一直在尝试和练习,以便在这方面做得更好。然而,我有一个奇怪的问题。今天早上我谷歌搜索了一个解决方案或领导但是有用,所以我问社区。让我来描述一下这个问题。请注意,这只是简单的练习练习而不是真正的应用程序。



这是我似乎能够毫无问题地做的事情。我可以将一个非常基本的报告(.rdlc)嵌入到我的WinForm中,并通过Report Viewer控件显示报告。当然,所有字段都在输出数据。这告诉我至少我已将所有数据布线到位,可以这么说。这意味着我的DataSet(.xsd)似乎是正确的,BindingSource,TableAdapters和Report DataSet也是如此。这里有很多作品,但我慢慢了解它。



但是对于我未来的应用程序,我想使用SQL Server Compact Edition 4.0数据库。所以我针对Northwind40数据源创建了所有适当的连接和对象,一切都很好。我觉得这个小小的CE 4.0数据库已经安装在某个地方并且很适合练习。



所以我使用相同的技能并且主要创建一个简单的报告显示来自[Northwind40]。[Categories]表中的CategoryID和Category,Description字段在我的表控件中的报表上。当我运行表单并且ReportViewer Control完成它的工作时,奇怪的是,我看到的只是带有Description的列。 CategoryID和Category列都是空白的。当我再次导出到Excel时,CategoryID和Category是空白的,并且描述很好并填写每一行。 CategoryID是System.int,Category和Description都是System.String。



嗯,我不确定这是一个问题,因为我使用的是SQL CE 4.0数据库?我不认为它是我的数据集,BindingSource或那些数据组件,因为我正在获取我想要的数据。它只是不会显示三个字段中的两个。我尝试了各种改变字体颜色,列大小,右/左单元格对齐等但没有。



我的Form1_Load代码中有两行:



Hello:

Although I am very new to using embedded Reports (.rdlc) in WinForm applications (in C#), I think I understand the basic concepts. I've been experimenting and practicing to get better at this. Yet, I am having one strange problem. I've Google searched all this morning for a solution or a lead but to avail so I am asking the community. Let me describe the issue. Please note, this is just simple practice exercise stuff and not a real application at this point.

Here is what I seem to be able to do without an issue. I can embed a very basic report (.rdlc) into my WinForm and show the report via the Report Viewer control. And, of course, all the fields are outputting their data. This tells me at least I have all the data wiring in place, so to speak. This means my DataSet (.xsd) seems correct and the BindingSource, TableAdapters, and the Report DataSet as well. There are lot of pieces here but I am slowly understanding it.

But for my future application I want to use a SQL Server Compact Edition 4.0 database. So I create all the appropriate connections and objects against the Northwind40 datasource and all is fine. This little CE 4.0 database I think got installed somewhere along the way and its good to practice with.

So I use the same skills and mostly create a simple report that shows the CategoryID and Category, Description fields from the [Northwind40].[Categories] table in my table control on the report. When I run the form and ReportViewer Control does its thing, strangely, all I see is the column with Description. Both CategoryID and Category columns are blank. When I export to Excel, again, CategoryID and Category are blank and Description is nice and filled in for each row. CategoryID is System.int and both Category and Description are System.String.

Well, I'm not sure if this an issue because I'm using SQL CE 4.0 database? I don't think its my dataset, BindingSource, or those data components because I am getting back the data I want. It just simply won't display two out of the three fields. I tried all sorts of changing the font color, column sizes, right/left cell alignment etc but nothing.

There are two lines in my Form1_Load code:

this.CategoriesTableAdapter.Fill(this.Northwind40.Categories);
this.reportViewer1.RefreshReport();





And我在.RefreshReport行上放了一个断点。此时,Northwind.Categories DataTable当然具有CategoryID(1)和Category(Beverages)的值,​​但它们再次不会在报告中显示描述(软饮料,咖啡,茶,啤酒和啤酒)



天哪,我只是不确定还能尝试什么。



欢迎任何帮助或潜在客户。先感谢您。再一次,这只是练习/学习问题,所以请给那些真正的生产问题优先于我的学习问题的人。再次感谢。



And I have put a breakpoint on the .RefreshReport line. At that point, certainly the Northwind.Categories DataTable has values for CategoryID (1) and Category (Beverages) but again they won't show on the report only the Description (Soft drinks, coffees, teas, beer, and ale)

Gosh, I'm just not sure what else to try.

Any help or leads will be welcome. Thank you in advance. And again, this is just practicing/learning question so please do give others who have real Production issue priority over my learning question. Thanks again.

推荐答案


这篇关于报表查看器不显示嵌入式.RDLC报表中的选定字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-05 22:48