简体   繁体   English

将Guid传递给SSRS 2008 Url Access参数

[英]Pass Guid to SSRS 2008 Url Access parameter

I am trying to use URL access to pull down some reports from sql server reporting services 2008. One of the parameters I need to pass is a Guid. 我正在尝试使用URL访问从sql server reporting services 2008中提取一些报告。我需要传递的参数之一是Guid。 When I just paste the guid in to the url as 当我只是将guid粘贴到url中时

&LoggerID=CD4869DC-68B8-4513-B3C6-0E6DD9F74380

I get the error: Default value or value provided for the report parameter 'LoggerID' is not a valid value. 我收到错误:为报告参数“LoggerID”提供的默认值或值不是有效值。 (rsInvalidReportParameter) (rsInvalidReportParameter)

I have tried single quotes and brackets and curly brackets. 我试过单引号,括号和大括号。 What am I missing? 我错过了什么?

I just ran into this problem and it turned out to be a problem with capitalization of the letters inside the Guid. 我刚遇到这个问题,结果证明Guid里面的字母大写有问题。

Since SSRS doesn't understand uniqueidentifiers it just treats them as strings. 由于SSRS不理解uniqueidentifier,它只是将它们视为字符串。 So if you have a 'Get values from query' option for that parameter, the url parameter you pass in must match the query results character for character. 因此,如果您为该参数提供了“从查询中获取值”选项,则传入的url参数必须与字符的查询结果字符匹配。 Meaning matching capitalization 意义匹配大写

It failed when on the url I had 在我的网址上它失败了

&entityIdentifier=75745B11-09B8-4BF6-98EF-F3E8A2ACEC05

but worked when I changed that to 但是当我改变它时工作

&entityIdentifier=75745b11-09b8-4bf6-98ef-f3e8a2acec05

It turns out that when you set the available values for a parameter as "Get values from Query" it won't accept the guid in the URL. 事实证明,当您将参数的可用值设置为“从查询中获取值”时,它将不接受URL中的guid。 As soon as I turn this off, it works. 一旦我关闭它,它就有效。 This only seems to be a problem for GUIDs as I am doing this with an integer and it works fine. 这似乎只是GUID的一个问题,因为我用一个整数这样做,它工作正常。

Related: 2008 still uses string as the parameter type. 相关:2008仍然使用string作为参数类型。

Passing a Guid in that format to one of my own reports works fine. 将该格式的Guid传递给我自己的报告之一可以正常工作。

I notice that your error message talks about a parameter called "LoggerID" yet your URL is using "guid" as the parameter name. 我注意到您的错误消息是关于一个名为“LoggerID”的参数,但您的URL使用“guid”作为参数名称。 It's not something simple like that? 这不是那么简单吗?

Also note that (in my experience) SSRS URL parameters are case sensitive. 另请注意(根据我的经验)SSRS URL参数区分大小写。 If you are passing "loggerid=..." on the URL and your parameter is called "LoggerID" then you'll get an error message (although it's not the error you describe, so I doubt that's the problem). 如果您在URL上传递“loggerid = ...”并且您的参数被称为“LoggerID”,那么您将收到一条错误消息(尽管这不是您描述的错误,因此我怀疑这是问题所在)。

Update 更新

I've just had a look at the report of mine in design mode, and it actually uses "String" for the parameter type. 我刚刚在设计模式中查看了我的报告,它实际上使用“String”作为参数类型。 In SSRS 2005 there isn't an option to use a Guid. 在SSRS 2005中,没有使用Guid的选项。 That might be an option for you (change the parameter to string and cast in the query), though it'd be a bit of a hack. 这可能是你的选择(将参数更改为字符串并在查询中强制转换),尽管它有点像黑客。

I have had the same problem couple of times, for some reason Guid in URL has to come in lower case otherwise it will not accept it. 我有几次同样的问题,由于某种原因,URL中的Guid必须小写,否则它将不接受它。

Make sure your Guid is formatted to lower case. 确保您的Guid格式化为小写。

I just ran into issues as well trying to pass a GUID parameter in through a URL. 我刚刚尝试通过URL传递GUID参数时遇到了问题。 My solution was to cast the uniqueidentifier to a varchar(36) in the Dataset query used for the parameter's available values. 我的解决方案是将uniqueidentifier转换为用于参数可用值的数据集查询中的varchar(36)。 Then, like others have mentioned, it was necessary to make sure the casing of the GUID in the URL matched the casing in the available values dataset. 然后,像其他人提到的那样,有必要确保URL中GUID的大小写与可用值数据集中的大小写匹配。

Available Values Dataset Query example: 可用值数据集查询示例:

SELECT CAST(MyGuidColumn AS varchar(36)) AS MyGuidColumn, MyLabelColumn
FROM  MyTable

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM