RS.exe and date-type parameter.
Hi All,
I have a report with 4 parameters, 2 of them are date-type parameter. I intend to run this report via RS.exe by passing different parameters for different scenario. The issue that I have at the moment is passing date-type parameter via the VB Script file.
In my report I use "dd-mm-yy" format. I tried many ways to assign date value to my parameters, but I am always getting the following error:
"Unhandled exception: Default value or value provided for the report parameter 'myParam' is not a valid value".
Syntax that I use:
myParam = "01-01-1900"
myParam = DateTime.Parse("01-01-1900")
myParam = DateTime.Parse("#01-01-1900#")
All of them didn't work.
My question: how to assign date value to the parameter?
Many Thanks,
Man
September 18th, 2006 7:24am
Can you post your script?
Free Windows Admin Tool Kit Click here and download it now
September 18th, 2006 6:47pm
Hi,
Thanks for your reply. However I solved the issue by changing the date format to US format (mm/dd/yy).
Cheers,
XL
September 20th, 2006 8:06am
Dim format as string = "PDF"
Dim fileName as String = "C:\"
Dim reportPath as String = "/Budget"
Public Sub Main()
'Prepare Render arguments
Dim historyID as string = Nothing
Dim deviceInfo as string = Nothing
Dim credentials As DataSourceCredentials() = Nothing
Dim showHide as string = Nothing
Dim results() as Byte
Dim encoding as string = Nothing
Dim mimeType as string = "ms-pdf"
Dim extension as string = "pdf"
Dim warnings() AS Warning = Nothing
Dim reportHistoryParameters() As ParameterValue = Nothing
Dim streamIDs() as string = Nothing
rs.Credentials = System.Net.CredentialCache.DefaultCredentials
fileName = fileName & Budget & ".pdf"
Dim parameters(4) As ParameterValue
parameters(0) = New ParameterValue()
parameters(0).Name = "DateStart"
parameters(0).Value = DateStart
parameters(1) = New ParameterValue()
parameters(1).Name = "DateEnd"
parameters(1).Value = DateEnd
parameters(2) = New ParameterValue()
parameters(2).Name = "State"
parameters(2).Value = State
parameters(3) = New ParameterValue()
parameters(3).Name = "City"
parameters(3).Value = City
results = rs.Render(reportPath, format, historyID, deviceInfo, parameters, _
credentials, showHide, encoding, mimeType, reportHistoryParameters, warnings, streamIDs)
' Open a file stream and write out the report
Dim stream As FileStream = File.OpenWrite(fileName)
stream.Write(results, 0, results.Length)
stream.Close()
End Sub
I am running the file by executing following command
rs -i run.rss -s http://hds2005/reportserver -v Start="01-01-10" -v End="01-01-11" -v State="California" -v City="San Francisco"
I get the following error:
Unhandled exception:
The operation you are attempting on item "/Budget" is not allowed for this item type.
Please help... Polly Cassidy
Free Windows Admin Tool Kit Click here and download it now
March 2nd, 2011 3:05pm
Hi Polly,
Sorry for late reply. I am wondering if you had resolved your issue?
Cheers,
Uzzie
April 18th, 2011 9:22pm