惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

K
Kaspersky official blog
Martin Fowler
Martin Fowler
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
V
Visual Studio Blog
博客园_首页
Engineering at Meta
Engineering at Meta
The Cloudflare Blog
MongoDB | Blog
MongoDB | Blog
Blog — PlanetScale
Blog — PlanetScale
T
The Blog of Author Tim Ferriss
雷峰网
雷峰网
D
Docker
博客园 - 司徒正美
S
SegmentFault 最新的问题
M
MIT News - Artificial intelligence
博客园 - 叶小钗
博客园 - 三生石上(FineUI控件)
U
Unit 42
J
Java Code Geeks
A
About on SuperTechFans
N
Netflix TechBlog - Medium
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
S
Security Affairs
I
Intezer
Cisco Talos Blog
Cisco Talos Blog
C
Cyber Attacks, Cyber Crime and Cyber Security
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
B
Blog RSS Feed
P
Privacy & Cybersecurity Law Blog
T
Tenable Blog
T
Threatpost
H
Hacker News: Front Page
G
Google Developers Blog
博客园 - 【当耐特】
Hugging Face - Blog
Hugging Face - Blog
Apple Machine Learning Research
Apple Machine Learning Research
L
Lohrmann on Cybersecurity
大猫的无限游戏
大猫的无限游戏
Google DeepMind News
Google DeepMind News
A
Arctic Wolf
S
Secure Thoughts
GbyAI
GbyAI
NISL@THU
NISL@THU
S
Security @ Cisco Blogs
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
Webroot Blog
Webroot Blog
C
CXSECURITY Database RSS Feed - CXSecurity.com
O
OpenAI News
Spread Privacy
Spread Privacy
Application and Cybersecurity Blog
Application and Cybersecurity Blog

博客园 - 小新0574

PayPal使用介绍 - 注册篇 VB6.0 IDE即将退出历史舞台 工作一年半记录 随便说说Silverlight 最近在学英语 真正理解ViewState - Part2 真正理解ViewState - part1 本地模式使用ReportViewer控件 编程使用资源文件实现多语言页面(In Action) ADO.NET2.0跟ADO.NET3.0的一些新特性简要介绍 关于Membership的设置 本地生成RDL报表文件的创建工具 可爱的上海人 Just a Test 回到了学校 到了上海 打算近期去深圳找工作 ASP.NET中的事件 第一天学习《Essential ASP.NET...》情况
使用WebService动态生成DataSet绑定到Reporting Services
小新0574 · 2006-08-22 · via 博客园 - 小新0574

看了 Carlwave-陆飞(Fei.Lu) 的VS2005+SQL2005 Reporting Service动态绑定报表(Web) ,我认为也许他的方案可行,但并不是很好。所以我找了一些资料,发现通过WebService动态生成的DataSet是可以绑定到Reporting Services,这样也就满足了对DataSet的可操作性,也就是你可以在WebService中编程操作DataSet.

我的步骤是这样的:
1.首先创建一个WebSerivce,然后写了一个Web Method:

    [WebMethod]
    
public XmlDataDocument GetDataSource()
    
{
        
string strCon;

        DataSet ds 
= new DataSet();
        XmlDataDocument xmlDataDoc;

        strCon 
= "Your Connection String";
        
        
string selectText = "Your Select String";

        SqlDataAdapter dataAdapter 
= new SqlDataAdapter(selectText,strCon);
        

        
try{
        dataAdapter.Fill(ds);

        xmlDataDoc 
= new XmlDataDocument(ds);
        }

        
catch
        
{
            xmlDataDoc 
= null;
        }

        
finally
        
{
            strCon 
= null;
            ds.Dispose();
        }

        
return xmlDataDoc;

    }

我们可以注意到。这里使用了XmlDataDocument,还记得陆飞文章中提到了XML文档,我们需要受到手动修改它吗?其实是不需要的,我们可以通过XmlDataDocument关联到DataSet生成相应的XML

2.新建一个Reporting Services项目,注意时Reporting Serverices项目,不是Report Viewer控件,关于他们的区别,参见:
http://msdn2.microsoft.com/zh-cn/library/ms345248.aspx

然后在Shared Data Source里新建一个DataSource,指定Type为XML,Connection String 为你的WebSerivce,比如说 http://localhost/WebService/Service.asmx(你可能需要在IIS中部署WebService)

然后新建一个Report,指定Query String 为:
<Query xmlns="http://Eric.org/">
    <SoapAction>http://Eric.org/GetDataSource</SoapAction>
</Query>

关于WebService的Query String语法,请参见:
http://msdn2.microsoft.com/en-us/library/ms345251.aspx

然后就可以取得数据了。

过程中,我遇到的一个问题是,如果在VS中创建的默认的WebService Namespace为http://tempuri.org/,Query String检查就会报错,你只要更改一个Namespace就可以了(如果说我改成了http://Eric.org

这样做的好处显而易见,就是可以使用Reporting Services的可视化报表设计系统了。

好久不写文章了,向大家问个好:)

参考文章:
http://www.codeproject.com/aspnet/WebAndReportingServices.asp