开发者

RDLC - "String Not Recognized As A Valid DateTime" Error

开发者 https://www.devze.com 2023-03-27 23:50 出处:网络
I know that there are lots of questions on SO very like this but none that seem to be quite the same.

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 d开发者_StackOverflowisplayed 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?!


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.


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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号