从SQL Server Reporting服务错误DownloadFile [英] Error DownloadFile from SQL Server Reporting services

查看:110
本文介绍了从SQL Server Reporting服务错误DownloadFile的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,


我有点绝望,我必须上传一个坏文件,或者我必须编译一个坏文件。因为现在我正在尝试制作
clientconn.DownloadFile(reportFilename,True)。它会返回以下错误: 


    Microsoft.SqlServer.Dts.Runtime.Wrapper.IDTSHttpClientConnection90.DownloadFile(String FileName,Boolean vbOverwriteDestination)

    Microsoft.SqlServer.Dts.Runtime.HttpClientConnection.DownloadFile(String fileName,Boolean OverwriteDestination)


我的代码如下:


< pre class ="prettyprint lang-vb"> Dim httpConn As ConnectionManager = Dts.Connections(" ReportServer")
Dim clientconn As HttpClientConnection = New HttpClientConnection(httpConn.AcquireConnection(Nothing))
' - PDF带路径的文件名
Dim arrPathParts As String()= Dts.Variables(" fileName")。Value.ToString()。Split(CChar(" \"))
Dim fileInfor As New System.IO.FileInfo(Dts.Variables(" fileName")。Value.ToString())

reportFilename = Dts.Variables(" pathAS73AR_Reports")。Value.ToString + arrPathParts( arrPathParts.Length - 1)+" .pdf"
writeLog(" Generating" + reportFilename)
' - 报告生成URL
clientconn.ServerURL =" http://160.220.89.11/ReportServer?/ PDFPrinting_Report / EmtexAS73AR03File& FileName = QUOT; + arrPathParts(arrPathParts.Length - 1)+"& rs:Command = Render& rs:Format = PDF& rc:Toolbar = False"
' - 下载PDFReport
clientconn.DownloadFile(reportFilename,True)
writeLog("文件" + reportFilename +")已生成。继续将其与发票模板合并到文件夹D:\ PDDFPrinting_Files; \\ MergerPDFs \中的文件"+ arrPathParts(arrPathParts.Length - 1)+"_1.pdf和"+ arrPathParts(arrPathParts.Length - 1)+"_2.pdf merged \。")

我知道代码很好,因为它曾经工作,但现在我不知道,因为当我打电话给" DownloadFile"方法,它让我失望。


我很感激任何帮助



谢谢你多为






解决方案

嗨耶稣奥比昂,


根据您的描述,我们检查了您的代码,以下是一些想法。


  1. 您是在SSIS环境中运行此脚本还是其他人?
  2. 在你的ServerURL中,这部分是什么意思"EmtexAS73AR03File",它的用途是什么?
  3. 你的错误信息很模糊,它包含很难没有效的信息。我们建议您添加Try Catch短语,以显示错误信息。

            Dim httpConn As ConnectionManager = Dts.Connections("ReportServer")
            Dim clientconn As HttpClientConnection = New HttpClientConnection(httpConn.AcquireConnection(Nothing))
            '--PDF File name with path
            Dim arrPathParts As String() = Dts.Variables("fileName").Value.ToString().Split(CChar("\"))
            Dim fileInfor As New System.IO.FileInfo(Dts.Variables("fileName").Value.ToString())

            reportFilename = Dts.Variables("pathAS73AR_Reports").Value.ToString + arrPathParts(arrPathParts.Length - 1) + ".pdf"
            writeLog("Generating " + reportFilename)
            '--Report Generation URL
            clientconn.ServerURL = "http://160.220.89.11/ReportServer?/PDFPrinting_Report/EmtexAS73AR03File&FileName=" + arrPathParts(arrPathParts.Length - 1) + "&rs:Command=Render&rs:Format=PDF&rc:Toolbar=False"
            '--Download PDFReport
            clientconn.DownloadFile(reportFilename, True)
            writeLog("The file " + reportFilename + " was generated. Proceeding to merge it with the invoice templates to the files " + arrPathParts(arrPathParts.Length - 1) + "_1.pdf and " + arrPathParts(arrPathParts.Length - 1) + "_2.pdf in the folder D:\PDFPrinting_Files\MergePDFs\merged\.")

I know the code is fine, because it used to work, but now I don't know because when I call the "DownloadFile" method, it fails me.

I'd appreciate any help

Thank you very much

解决方案

Hi Jesus Obiang,

According to your description, we’ve checked your code, following is a few thoughts.

  1. Were you running this script in SSIS environment or others?
  2. In your ServerURL what is this part mean "EmtexAS73AR03File", and what does it for?
  3. Your error info is quite ambiguous, it contains hard no effective info . We suggest you to add Try Catch phrase, to show the error info.

Try

***Your Code Block Here***

Catch ex As Exception

           
MessageBox.Show(ex.Message)

End Try

Best regards,

Lukas


这篇关于从SQL Server Reporting服务错误DownloadFile的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆