0

我有一種情況,當我試圖運行rs.exe來運行我的報表(帶有參數)時。使用rs.exe在報表服務器上運行參數報告

我使用低於此蝙蝠腳本:

"\\server\R\subfolder\working\app\rs.exe" -i \\server\R\subfolder\working\inputfile\coo.rss -s "http://server/ReportServer_MSSQLSERVER2" -v FILENAME="\\server\R\subfolder\working\inputfile\file.csv" -v REPORTSERVER_FOLDER="/FILE_REPORT/FILE" -v Inputfile='DocType' -t -v FORMAT="EXCEL" -e Exec2005 

在上述球棒腳本(名稱coo.bat),I硬編碼報告參數(其isInputfile ='的DocType)和I然後在報告中引用這下面的服務腳本:

Public Sub Main() 

Dim separators As String = " " 
Dim Commands As String = Microsoft.VisualBasic.Command() 
DIm inputid As string 
Dim args() As String = Commands.Split(separators.ToCharArray) 
Dim argcount As Integer = 0 
For Each x As String In args 
argcount += 1 
Next 
inputid = args(0).ToUpper 

    TRY 

    DIM deviceInfo as string = Nothing 
    DIM extension as string = Nothing 
    DIM encoding as string 
    DIM mimeType as string = "application/Excel" 
    DIM warnings() AS Warning = Nothing 
    DIM streamIDs() as string = Nothing 
    DIM results() as Byte 

    rs.Credentials = System.Net.CredentialCache.DefaultCredentials 
    rs.LoadReport(REPORTSERVER_FOLDER, inputid) 

    results = rs.Render(FORMAT, deviceInfo, extension, mimeType, encoding, warnings, streamIDs) 

    DIM stream As FileStream = File.OpenWrite(FILENAME) 
    stream.Write(results, 0, results.Length) 
    stream.Close() 

    Catch e As IOException 
     Console.WriteLine(e.Message) 
    End Try 
End Sub 

但是,每當我執行coo.bat,我不斷收到:Unhandled exception:The parameter value provided for 'snapshotID' does not match the parameter type.

我會感謝你的投入。

+0

這與此相關嗎? http://stackoverflow.com/questions/26894648/snapshotid-parameter-type-mismatch-when-calling-render-method-on-reportexecution – lit

+0

@Liturgist:沒有它沒有。鏈接中的一個是.asmx文件,而我正在談論的是.rss文件。 –

回答

1

我終於找到了解決方案。請參閱編輯代碼

Public Sub Main() 

Dim separators As String = " " 
Dim Commands As String = Microsoft.VisualBasic.Command() 
Dim args() As String = Commands.Split(separators.ToString) 
'Report Parameters 
Dim parameters(1) As ParameterValue 
parameters(0) = New ParameterValue() 
parameters(0).Name = "Inputfile" 
parameters(0).Value =Inputfile 


    TRY 
    DIM historyID as string = Nothing 
    DIM deviceInfo as string = Nothing 
    DIM extension as string = Nothing 
    DIM encoding as string 
    DIM mimeType as string = "application/Excel" 
    DIM warnings() AS Warning = Nothing 
    DIM streamIDs() as string = Nothing 
    DIM results() as Byte 

    rs.Credentials = System.Net.CredentialCache.DefaultCredentials 
    rs.LoadReport(REPORTSERVER_FOLDER,historyID) 
    rs.SetExecutionParameters(parameters, "en-us") 
    results = rs.Render(FORMAT, deviceInfo, extension, mimeType, encoding, warnings, streamIDs) 

    DIM stream As FileStream = File.OpenWrite(FILENAME) 
    stream.Write(results, 0, results.Length) 
    stream.Close() 

    Catch e As IOException 
     Console.WriteLine(e.Message) 
    End Try 
End Sub 
相關問題