Microsoft报表查看器不显示任何报表

时间:2021-07-27 08:16:55

I am working on a small windows application. The application needs to show some reports. For each report, I made a simple form with Report Viewer control. When the form shows up, I call the RefreshReport() method and the report is shown. My problem is this - one report does not show up at all. I get only form with empty ReportViewer control. There is also no "Generating report" message. The query I use returns the correct data, but I am unable to get anything when I run the application. For each of the reports, I am using separate dataset. In each DtaSet I have placed the tables I want to use in corresponding report. I I have also tried to create this particular report using Report Server Project Wizard (Business Intelligence Project > Report Server in Visual Studio). It showed the report correctly. I used exactly the same settings, same query, everything is identical. What could be the problem? Why is Visual Studio unable to show me this report? The other reports are working fine.

我正在开发一个小型Windows应用程序。该应用程序需要显示一些报告。对于每个报告,我使用Report Viewer控件创建了一个简单的表单。当表单出现时,我调用RefreshReport()方法并显示报告。我的问题是这个 - 一份报告根本没有出现。我只获得带有空ReportViewer控件的表单。也没有“生成报告”消息。我使用的查询返回正确的数据,但是当我运行应用程序时,我无法获得任何内容。对于每个报告,我使用单独的数据集。在每个DtaSet中,我已将我想要使用的表放在相应的报告中。我还尝试使用报表服务器项目向导(Visual Studio中的商业智能项目>报表服务器)创建此特定报表。它正确地显示了报告。我使用完全相同的设置,相同的查询,一切都是相同的。可能是什么问题呢?为什么Visual Studio无法向我显示此报告?其他报告工作正常。

Thanks

谢谢

1 个解决方案

#1


1  

Ok, I found out what was happening. For some reason, an exception was thrown during the creation of the report. The exception was "invisible" - there was no any message about it, nothing. I caught it when I was debugging the whole thing line by line. It seems that the exception originates on the database level, when the query is executed (the query contains several JOIN commands). I solved the whole thing by simply putting the Fill() method, which fills the dataset when the form is opened in the try block, with an empty catch block. The report showed correctly.

好的,我发现了发生了什么。出于某种原因,在创建报告期间抛出了异常。例外是“看不见的” - 没有任何关于它的消息,没有任何消息。当我逐行调试整个事情时,我抓住了它。当执行查询时(查询包含多个JOIN命令),似乎异常起源于数据库级别。我通过简单地放置Fill()方法解决了整个问题,该方法在try块中打开表单时填充数据集,并带有一个空的catch块。报告显示正确。

#1


1  

Ok, I found out what was happening. For some reason, an exception was thrown during the creation of the report. The exception was "invisible" - there was no any message about it, nothing. I caught it when I was debugging the whole thing line by line. It seems that the exception originates on the database level, when the query is executed (the query contains several JOIN commands). I solved the whole thing by simply putting the Fill() method, which fills the dataset when the form is opened in the try block, with an empty catch block. The report showed correctly.

好的,我发现了发生了什么。出于某种原因,在创建报告期间抛出了异常。例外是“看不见的” - 没有任何关于它的消息,没有任何消息。当我逐行调试整个事情时,我抓住了它。当执行查询时(查询包含多个JOIN命令),似乎异常起源于数据库级别。我通过简单地放置Fill()方法解决了整个问题,该方法在try块中打开表单时填充数据集,并带有一个空的catch块。报告显示正确。