469,898 Members | 1,581 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,898 developers. It's quick & easy.

Using RS.EXE to export a report from Command Line (URGENT)

' File: Test.rss
Dim format as string = "Excel"
Dim fileName as String = "C:\Export2.xls"
Dim reportPath as String = "/TimeByEmployee"

Public Sub Main()

' Prepare Render arguments
Dim historyID as string = Nothing
Dim deviceInfo as string = Nothing
Dim showHide as string = Nothing
Dim results() as Byte
Dim encoding as string
Dim mimeType as string = "ms-excel"
Dim warnings() AS Warning = Nothing
Dim reportHistoryParameters() As ParameterValue = Nothing
Dim streamIDs() as string = Nothing
rs.Credentials = System.Net.CredentialCache.DefaultCredentials

Dim parameters(3) As ParameterValue
parameters(0) = New ParameterValue()
parameters(0).Name = "Employee"
parameters(0).Value = " "
parameters(1) = New ParameterValue()
parameters(1).Name = "Departments"
parameters(1).Value = " "
parameters(2) = New ParameterValue()
parameters(2).Name = "Week Number"
parameters(2).Value = WeekNumber
results = rs.Render(reportPath, format, _
Nothing, Nothing, parameters, _
Nothing, Nothing, 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

'End of script



here is how i run it



rs -i RunReport.rss -s http://localhost/reportserver -v WeekNumber=90 -e mgmt2000



this is the error i get:

The value of parameter 'Parameters' is not valid. also how can i cgange this line to pdf

Dim mimeType as string = "ms-excel" i tried this but it did not

work

Dim mimeType as string = "ms-pdf"


Thanks
Oct 26 '07 #1
1 5276
Don't know about the Parameters error, but if the first two parameter values are defaulted within the report, you may not want to specify them in script at all.

As far as switching from Excel to PDF, replace your corresponding statements with the following:

Expand|Select|Wrap|Line Numbers
  1. Dim format as string = "PDF"
  2. Dim mimeType as string = "application/pdf"
  3.  
Hope this helps.
Feb 12 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

reply views Thread by suicidaltendencies | last post: by
10 posts views Thread by Simon | last post: by
reply views Thread by sundowner225 | last post: by
6 posts views Thread by no_spam_for_gman | last post: by
1 post views Thread by Waqarahmed | last post: by
reply views Thread by Salome Sato | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.