菜鸟请教大大们 关于ssrs 如何获取url上参数的问题

sheight 2010-12-01 09:01:07
比如说 新建一个报表 数据源里面 查询语句 为 select * from sl_pm_project where project_id=@id


后面的参数@id的如何获取我写在jsp上的一个链接 http://localhost:8080/Reports/Pages/Folder.aspx?ItemPath=%2f%e6%8a%a5%e8%a1%a8%e9%a1%b9%e7%9b%ae1&id=1111111111
也就是我的sql 语句如何获得url上的id=11111这个值的

通过修改 代码文件 .rdl[xml]文件 里面的内容能实现吗或者是别的实现方式

急需 拜托各位大大
...全文
462 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
sheight 2010-12-02
  • 打赏
  • 举报
回复
I think you're pointing your url to the wrong location. Instead of the reports area of your local host (which I admit makes a lot of sense) you should use the ReportServer. See this article:
http://msdn2.microsoft.com/en-us/library/aa256630(SQL.80).aspx
so, you probably want something closer to this:
http://localhost/reportserver?/DashboardReports/Horse_Profile/&rs:Command=Render&HorseID=117415

thanks everyone all the same
sheight 2010-12-01
  • 打赏
  • 举报
回复
<td align="center">
<a target="_slef" href="/http://10.24.1.191/Reports/Pages/Report.aspx?ItemPath=%2f%e6%8a%a5%e8%a1%a8%e9%a1%b9%e7%9b%ae1%2f%e8%b5%84%e6%ba%90%e4%bd%bf%e7%94%a8%e6%98%8e%e7%bb%86&project_id=<%=project_id%>">
资源管理明细</a>
</td>

jsp 里面的链接 我是这样写的 这里 资源管理明细 就是超链接 我就是要点击这个 链接 进入报表 报表里面的 sql 语句 获取到 后面跟着的 project_id 这个参数
yigerendeC 2010-12-01
  • 打赏
  • 举报
回复
在前台获取id的值吧?
华夏小卒 2010-12-01
  • 打赏
  • 举报
回复
不管地址是什么样的。
你要先用jsp 代码获取这个地址到参数
sheight 2010-12-01
  • 打赏
  • 举报
回复
<td align="center">
<a target="_slef" href="/http://10.24.1.191/Reports/Pages/Report.aspx?ItemPath=%2f%e6%8a%a5%e8%a1%a8%e9%a1%b9%e7%9b%ae1%2f%e8%b5%84%e6%ba%90%e4%bd%bf%e7%94%a8%e6%98%8e%e7%bb%86&project_id=JSXM-10-060-01">
资源管理明细</a>
</td>

jsp 里面的链接 我是这样写的
sheight 2010-12-01
  • 打赏
  • 举报
回复
我上面那个sql 语句只是我写的一个简单的 这个参数要用到好几个地方
select s.curtmhrow,s.username,s.daymaa, f.daymansum,y.all_val,s.project_id from (select distinct curtmhrow ,a.username as username,sum(dayman) as daymaa ,project_id from
fnb_kaoqin_import a where
a.project_id =@project_id group by a.username , curtmhrow,project_id) s left join (select distinct curtmhrow ,sum(dayman) as daymansum from fnb_kaoqin_import f where f.project_id=@project_id
group by curtmhrow ) f on s.curtmhrow =f.curtmhrow
left join
(SELECT curtmhrow,(SELECT SUM(dayman) FROM fnb_kaoqin_import as t WHERE
t.curtmhrow <= h.curtmhrow and t.project_id=@project_id) AS all_val
FROM fnb_kaoqin_import h where h.project_id=@project_id GROUP BY curtmhrow) y
on s.curtmhrow=y.curtmhrow
华夏小卒 2010-12-01
  • 打赏
  • 举报
回复
应该是前台代码(jsp)获取这个 http://localhost:8080/Reports/Pages/Folder.aspx?ItemPath=%2f%e6%8a%a5%e8%a1%a8%e9%a1%b9%e7%9b%ae1&id=1111111111
保存参数里,或者获取1111111111 存储在参数里。
然后select 哦
「已注销」 2010-12-01
  • 打赏
  • 举报
回复
你在jsp中取得这个url作为变量传到后台DB中处理,或者再前台处理这个字符直接取得ID。
sheight 2010-12-01
  • 打赏
  • 举报
回复
zsh0809:
我的那个url链接是写在jsp里面的 id也是动态的 jsp里面有个project列表 我的想法是 首先点击页面上的项目id 然后触发那个链接 进入到报表 报表里面的 sql 语句获取 url后面的参数 你这里 把链接写死到sql语句里面是不是行不通啊
「已注销」 2010-12-01
  • 打赏
  • 举报
回复
把你的url地址取出来传到sql中去:参考
DECLARE @html VARCHAR(200)
DECLARE @id VARCHAR(10)
SET @html='http://localhost:8080/Reports/Pages/Folder.aspx?ItemPath=%2f%e6%8a%a5%e8%a1%a8%e9%a1%b9%e7%9b%ae1&id=1111111111'
SELECT RIGHT(@html,len(@html)- CHARINDEX('&id=',@html)-3)

exec('select * from sl_pm_project where project_id=' + @id)


695

社区成员

发帖
与我相关
我的任务
社区描述
提出问题
其他 技术论坛(原bbs)
社区管理员
  • community_281
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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