Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/performance/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Sql server 在ReportExecution2005.asmx SSRS服务上调用Render方法时snapshotID参数类型不匹配_Sql Server_Web Services_Reporting Services - Fatal编程技术网

Sql server 在ReportExecution2005.asmx SSRS服务上调用Render方法时snapshotID参数类型不匹配

Sql server 在ReportExecution2005.asmx SSRS服务上调用Render方法时snapshotID参数类型不匹配,sql-server,web-services,reporting-services,Sql Server,Web Services,Reporting Services,我正在尝试在带有MSSQL 2012后端的SSRS 2012服务器上使用ReportExecution2005.asmx服务端点以PDF格式呈现报告。在web服务上调用Render方法时,出现以下错误: 为“snapshotID”提供的参数值与参数类型不匹配。-->Microsoft.ReportingServices.Diagnostics.Utilities.ParameterTypeMismatchException:为“snapshotID”提供的参数值与参数类型不匹配。-->Syste

我正在尝试在带有MSSQL 2012后端的SSRS 2012服务器上使用ReportExecution2005.asmx服务端点以PDF格式呈现报告。在web服务上调用Render方法时,出现以下错误: 为“snapshotID”提供的参数值与参数类型不匹配。-->Microsoft.ReportingServices.Diagnostics.Utilities.ParameterTypeMismatchException:为“snapshotID”提供的参数值与参数类型不匹配。-->System.FormatException:字符串未被识别为有效的日期时间

此错误发生在我尝试呈现的任何报表中,snapshotID不是报表上的参数,并且检查报表的配置时,未将其设置为缓存或使用快照。我们最近刚从MSSQL 2005迁移到2012,使用ReportExecution2005端点和SSRS和SQL 2005。我从未看到过这个错误,它工作得很好。我曾尝试将snapshotID添加为具有不同值(如空字符串、当前时间等)的参数,但这显然不是它想要的。下面是我用来设置和调用服务的Render方法的代码。在我的例子中,pstrExportFormat将是“PDF”

Public Function ExportReport(pstrReportPath作为字符串,plstParams作为列表(ReportParameter的),pstrExportFormat作为字符串)作为Byte()
Dim lResults()作为字节=无
作为字符串的Dim lstrSessionId
Dim ExecutionInfo作为新的reporting.ExecutionInfo
Dim ExecutionHeader作为新的reporting.ExecutionHeader
Dim LSTRHISTRYID为String=String.Empty
尝试
Dim rs作为新的reporting.ReportExecutionService
将设备信息设置为字符串=“8.5in11in0.25in0.25in0.25in0.25in0.25in”
rs.Credentials=System.Net.CredentialCache.DefaultCredentials
Dim参数作为新列表(reporting.ParameterValue的列表)
Dim param As reporting.ParameterValue
rs.Credentials=System.Net.CredentialCache.DefaultCredentials
对于plstParams中的每个lInputParam
param=新的reporting.ParameterValue
param.Name=lInputParam.Name
参数值=lInputParam.Value
参数添加(参数)
下一个
rs.ExecutionHeaderValue=ExecutionHeader
execInfo=rs.LoadReport(pstrReportPath,lstryStoryId)
rs.SetExecutionParameters(参数ToArray,“en-us”)
lResults=rs.Render(pstrExportFormat、deviceInfo、“”、“”、“”、Nothing、Nothing)
特例
扔
结束尝试
返回结果
端函数

一些附加信息,此代码来自VS 2012 Pro内置的应用程序,目标是.NET 2.0框架。我曾尝试针对一个较新的框架,但这给了我一个完全不同的ReportExecutionService对象,我无法以相同的方式分配凭据,在这种情况下,呈现方法也不同


有没有关于变通方法的想法,或者更好的以编程方式呈现报告的方法?谢谢。

我今天遇到了完全相同的问题,并且发现在LoadReport方法中,您希望确保HistoryID的值为Nothing(在C#中为null)。现在,您正在传递一个空字符串-将声明更改为

  Dim lstrHistoryId As String = Nothing
或者将方法调用更改为

rs.LoadReport(pstrReportPath, Nothing)

完美的这就是问题所在,在将空字符串替换为空字符串之后,现在一切都很好。非常感谢。当我给字符串histroyId=null时,它对我来说就像一个符咒;在C#XOR中,如果碰巧直接进行SOAP调用,则不要为“HistoryID”指定Xml元素。处理方式与传入空字符串相同。
rs.LoadReport(pstrReportPath, Nothing)