RDLC - “字符串未被识别为有效的日期时间”错误

发布于 2024-11-29 15:20:56 字数 557 浏览 1 评论 0原文

我知道有很多类似的问题,但没有一个看起来完全相同。

我有一个 ASP.NET 页面,在其中添加了 ReportViewer 控件来显示 RDLC 本地报告。报表的数据源设置为页面上的 SQL 数据源,该数据源根据页面上的两个文本框筛选日期。然而,报告本身没有参数,它不包含显示或数据集中的日期/时间字段,并且根本没有过滤器。

当我查看页面时,现在今天的日期(8 月 15 日)作为美国格式日期 (MM/dd/yyyy) 无效,并且被用作日期过滤器之一,我收到“字符串未识别为有效日期时间” “在我的报告查看器中。我不知道为什么报告关心页面上文本框中的日期 - 除了通过数据源之外,它没有以任何方式链接到它。

出于兴趣,我创建了一个没有日期过滤器的新数据源,只是简单、简单地检索客户信息并将其设置为报告的数据源,但我仍然收到错误。就好像报表查看器在没有被告知的情况下验证文本框中的日期 - 并且出错了!

我还使用日期过滤数据源向页面添加了 GridView,它工作得很好,证明 SQL 数据源本身可以毫无问题地从数据库检索信息。

这只是愚蠢的报表查看器控件!有什么方法可以告诉它闭嘴并停止检查与它无关的文本框中的日期吗?!

I know that there are lots of questions on SO very like this but none that seem to be quite the same.

I have an ASP.NET page onto which I've added a ReportViewer control to display and RDLC local report. The report's datasource is set to an SQL datasource on the page which filters for dates according to two textboxes on the page. However, the report itself has NO parameters, it contains NO fields which are date/time either displayed or in its dataset and there are NO filters at all.

When I view the page, now that today's date (15th August) is not valid as an American format date (MM/dd/yyyy) and is being used as one of the date filters I get a "String not recognized as a valid datetime" in my reportviewer. I have no idea why the report cares about the date in the textbox on the page - it's not linked to it in any way other than via the datasource.

Out of interest I've created a new datasource which has no date filters, just a plain, simple retrieval of client information and set it as the report's datasource, and I'm STILL getting the error. It's as if the reportviewer is validating the date in the textbox without being told to - and getting it wrong!

I also added a GridView to the page using the date-filtered datasource, and it works just fine, proving that the SQL datasource itself is retrieving the information from the database without a problem.

It's just the stupid reportviewer control! Is there any way to tell it to shut up and stop checking a date in a textbox which is nothing to do with it?!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

生死何惧 2024-12-06 15:20:56

没关系,两天后我就明白了!通过将报告属性中的语言设置为“en-GB”,它不再抱怨日期的格式,尽管我仍然不明白为什么它首先要检查它们。我无法结束自己的问题,因为我太新了。

It's ok, I figured this out after two days! By setting the Language in the Report's properties to 'en-GB' it stopped complaining about the format of the dates, although I still don't understand why it was checking them in the first place. I can't close my own question because I'm too new.

深居我梦 2024-12-06 15:20:56

这与计算机上的区域和语言设置有关。

It has to do with the region and language settings on the computer.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文