Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using RS.EXE to export a report from Command Line

Status
Not open for further replies.

DanEvans

MIS
Oct 15, 2001
29
US
Hi there,
I am trying to get a report to export to a pdf or xls file at a specific location using a command line action. I got the example for Publishing sample reports to work at the following site: I am trying to modify this example to get it to put a file out to a directory.

The code I am using in my .rss file is:
Code:
Public Sub Main()

        'setting the credentials to the machine that this application is running on
        rs.Credentials = System.Net.CredentialCache.DefaultCredentials


        Dim ResultStream() As Byte
        Dim filename As String = "Test.pdf"
       
        'rendering the report as a pdf
        ResultStream = ReportExecutionService.Render("[URL unfurl="true"]http://MyServer/reportserver?/AdventureWorks+Sample+Reports/Company+Sales",[/URL] 
		"PDF", Nothing, "<DeviceInfo><StreamRoot>/RSWebServiceXS/</StreamRoot></DeviceInfo>", 
		Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing)


        'creating a file to hold the stream
        Dim stream As FileStream = File.Create("C:\whatever" + filename)


        'writing the stream to the file
        stream.Write(ResultStream, 0, ResultStream.Length)
        stream.Close()
 
End Sub

The command line is:
Code:
C:\Program Files\Microsoft SQL Server\90\Samples\Reporting Services\Script Sampl
es>rs -i ExportRenderTest.rss -s [URL unfurl="true"]http://dbasql01/reportserver[/URL]

I am getting the error: C:\Documents and Settings\dan.evans\Local Settings\Temp\c6xhwdrx.1.vb(24) : error BC30456: 'Render' is not a member of 'Microsoft.SqlServer.ReportingServices2005.ReportingService2005'.

Has anyone had any experience doing this sort of thing? My code sample above comes from the cool thread thread1462-1073733.

My holy grail is to create an ssis package that accepts some arguments (source rs report path, destination path, report parms, destination file format, etc...) that I can use over and over again to manage some automated report distribution.

Thanks in advance for any help you can give!!!

Thanks,
Dan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top