用过RrportingServis的朋友请帮忙

anmyyan 2005-04-25 03:24:46
我是采用如下方法连接ReportingServis的
Dim rs As New ReportingService
rs.Credentials = System.Net.CredentialCache.DefaultCredentials '基本认证
Dim result As Byte() = Nothing

Dim reportPath As String = "http://yc3-a3/Reports/Pages/Report.aspx?ItemPath=%2fSample+Reports%2fEmployee+Sales+Summary"
Dim format As String = "MHTML"
Dim historyID As String = Nothing
Dim devInfo As String = "<DeviceInfo> <Toolbar>False</Toolbar> </DeviceInfo>"
' 报表参数
Dim parameters(2) As ParameterValue
parameters(0) = New ParameterValue
parameters(0).Name = "EmpID"
parameters(0).Value = "38"
parameters(1) = New ParameterValue
parameters(1).Name = "ReportMonth"
parameters(1).Value = "6" ' June
parameters(2) = New ParameterValue
parameters(2).Name = "ReportYear"
parameters(2).Value = "2004"
Dim credentials As DataSourceCredentials() = Nothing
Dim showHideToggle As String = Nothing
Dim encoding As String
Dim mimeType As String
Dim warnings As Warning() = Nothing
Dim reportHistoryParameters As ParameterValue() = Nothing
Dim streamIDs As String() = Nothing
Dim sh As New SessionHeader
rs.SessionHeaderValue = sh
Try
result = rs.Render(reportPath, format, historyID, devInfo, parameters, credentials, showHideToggle, encoding, mimeType, reportHistoryParameters, warnings, streamIDs)
sh.SessionId = rs.SessionHeaderValue.SessionId
Catch ex As SoapException
Console.WriteLine(ex.Detail.OuterXml)
End Try
' 保存为 MHTML 文件,也可以直接 Response 给客户端
Try
Dim stream As FileStream = File.Create("report.mhtml", result.Length)
stream.Write(result, 0, result.Length)
stream.Close()
Catch ex As Exception
Console.WriteLine(ex.Message)
End Try


但在两个Try中都会抛出异常

提示是To render a report, enter the ServerUrl and ReportPath.
到底是怎么回事,请大家指点
...全文
45 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
水如烟 2005-04-25
  • 打赏
  • 举报
回复
可能冷门了些。供应商应该提供这方面的服务的。
anmyyan 2005-04-25
  • 打赏
  • 举报
回复
没人理,自己顶

16,720

社区成员

发帖
与我相关
我的任务
社区描述
VB技术相关讨论,主要为经典vb,即VB6.0
社区管理员
  • VB.NET
  • 水哥阿乐
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧