Hello all,
using SQL 2008 sp3
using RS 2008
Running SSMS from client machine
I'm trying to create a rs script task to export out to Excel.
Keep getting an Error (at bottom).
In sql using this:
EXEC Master.dbo.xp_cmdshell 'rs -i "\\mySQLserver\drive_e\RS Scripts\MyRSSfile.rss" -s http://mySQLserver:80/reportserver/reportExecution2005.asmx?WSDL -e Exec2005'
MyRSSfile.rss:
Dim reportPath As String = "/My Path/My report" Dim format As String = "EXCEL" Dim historyID As String = Nothing Dim fileName As String = "\\MyOuputServer\Sharename\MyRSSfile.xls" 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(5) As ParameterValue parameters(0) = New ParameterValue() parameters(0).Name = "LastRunDate" parameters(0).Value = string.empty parameters(1) = New ParameterValue() parameters(1).Name = "TimeDuration" parameters(1).Value = string.empty parameters(2) = New ParameterValue() parameters(2).Name = "UserName" parameters(2).Value = string.empty parameters(3) = New ParameterValue() parameters(3).Name = "DateValue" parameters(3).Value = string.empty parameters(4) = New ParameterValue() parameters(4).Name = "YearValue" parameters(4).Value = string.empty parameters(5) = New ParameterValue() parameters(5).Name = "SortOrder" parameters(5).Value = "RowNumber ASC" 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
The error I'm getting:
The specified script failed to compile with the following errors:
C:\Windows\system32> "C:\Windows\Microsoft.NET\Framework\v2.0.50727\vbc.exe" /t:exe /main:MainModule /utf8output /R:"System.dll" /R:"System.Xml.dll" /R:"System.Web.Services.dll" /R:"C:\Program Files (x86)\Microsoft
SQL Server\100\Tools\Binn\rs.exe" /out:"
C:\Users\SQL2KAdmin\AppData\Local\Temp\zdpxzjxb.exe" /debug- "C:\Users\SQL2KAdmin\AppData\Local\Temp\zdpxzjxb.0.vb" "C:\Users\SQL2KAdmin\AppData\Local\Temp\zdpxzjxb.1.vb"
NULL
NULL
Microsoft (R) Visual Basic Compiler version 8.0.50727.5420
for Microsoft (R) .NET Framework version 2.0.50727.5466
Copyright (c) Microsoft Corporation. All rights reserved.
NULL
C:\Users\SQL2KAdmin\AppData\Local\Temp\zdpxzjxb.1.vb(64) : error BC30311: Value of type '1-dimensional array of Microsoft.SqlServer.ReportingServices2005.Execution.ParameterValue' cannot be converted to 'String'.
NULL
results = rs.Render(reportPath, format, Nothing, Nothing, parameters, Nothing, Nothing, encoding, mimeType, reportHistoryParameters, warnings, streamIDs)
~~~~~~~~~~
C:\Users\SQL2KAdmin\AppData\Local\Temp\zdpxzjxb.1.vb(64) : error BC30057: Too many arguments to 'Public Function Render(Format As String, DeviceInfo As String, ByRef Extension As String, ByRef MimeType As String, ByRef Encoding As String, ByRef Warnings()
As Microsoft.SqlServer.ReportingServices2005.Execution.Warning, ByRef StreamIds() As String) As Byte()'.
NULL
results = rs.Render(reportPath, format, Nothing, Nothing, parameters, Nothing, Nothing, encoding, mimeType, reportHistoryParameters, warnings, streamIDs)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
NULL
Thanks,
gv
Sword