ReportExecution2005.asmx Date Parameter
I am trying to programatically run a report from an SSRS 2005 server using ReportExecution2005.asmx calls from a C# program. The report I want to run has 1 date parameter. I cannot find any documentation, nor can I figure out, what date format I am intended to use when setting the parameter on the server using the SetExecutionParameters call. The question is really: what should I be putting in the whatShouldThisValueBe variable to make this code submit to the report server? In the web-based administration console (/reports virtual directory), I can submit "1/1/2000" and the report processes fine. When I submit the report to process with the parameter as is in the code segment below, I get the following error: "The value provided for the report parameter 'StartDate' is not valid for its type." Here is the example code: string whatShouldThisValueBe = "1/1/2000"; List<SSRS_ReportExecution2005.ParameterValue> parametersToSend = new List<SSRS_ReportExecution2005.ParameterValue>(); parametersToSend.Add(new SSRS_ReportExecution2005.ParameterValue()); parametersToSend[0].Name = "StartDate"; parametersToSend[0].Value = whatShouldThisValueBe; execInfo = webService.SetExecutionParameters(parametersToSend.ToArray(), "en-us"); Thanks for any guidance. Also, pointing me at the documentation that has this answer would be great. I've looked myself with no luck. Thanks, Michael
February 23rd, 2011 7:43pm

Please try passing the value as given below parametersToSend.Add(new SSRS_ReportExecution2005.ParameterValue()); parametersToSend[0].Name = "StartDate"; parametersToSend[0].Value = "2011-02-10"; The value you are passing should be a valid date. The above format yyyy-mm-dd worked quite good with my testing. If you are reading the date via a UI, you may have to convert the string to be in proper format. Hope this helps. Please let us know if you need any further help.Please click "Mark as Answer" if this resolves your problem or "Vote as Helpful" if you find it helpful. BH
Free Windows Admin Tool Kit Click here and download it now
February 24th, 2011 7:45pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics