Tải bản đầy đủ (.pdf) (620 trang)

Wrox professional SQL server reporting services may 2004 ISBN 0764568787 pdf

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (12.8 MB, 620 trang )


Professional SQL Server®
Reporting Services

Paul Turley
Todd Bryant
James Counihan
George McKee
Dave DuVarney

Wiley Publishing, Inc.



Professional SQL Server®
Reporting Services



Professional SQL Server®
Reporting Services

Paul Turley
Todd Bryant
James Counihan
George McKee
Dave DuVarney

Wiley Publishing, Inc.



Professional SQL Server® Reporting Services
Published by
Wiley Publishing, Inc.
10475 Crosspoint Boulevard
Indianapolis, IN 46256
www.wiley.com
Copyright © 2004 by Wiley Publishing, Inc., Indianapolis, Indiana
Published simultaneously in Canada
ISBN: 0-7645-6878-7
Manufactured in the United States of America
10 9 8 7 6 5 4 3 2 1
No part of this publication may be reproduced, stored in a retrieval system or transmitted in any form or by
any means, electronic, mechanical, photocopying, recording, scanning or otherwise, except as permitted
under Sections 107 or 108 of the 1976 United States Copyright Act, without either the prior written permission of the Publisher, or authorization through payment of the appropriate per-copy fee to the Copyright
Clearance Center, 222 Rosewood Drive, Danvers, MA 01923, (978) 750-8400, fax (978) 646-8700. Address
requests to the Publisher for permission to the Legal Department, Wiley Publishing, Inc., 10475 Crosspoint
Blvd., Indianapolis, IN 46256, (317) 572-3447, fax (317) 572-4447, Email:
LIMIT OF LIABILITY/DISCLAIMER OF WARRANTY: THE PUBLISHER AND THE AUTHOR MAKE NO
REPRESENTATIONS OR WARRANTIES WITH RESPECT TO THE ACCURACY OR COMPLETENESS OF
THE CONTENTS OF THIS WORK AND SPECIFICALLY DISCLAIM ALL WARRANTIES, INCLUDING
WITHOUT LIMITATION WARRANTIES OF FITNESS FOR A PARTICULAR PURPOSE. NO WARRANTY
MAY BE CREATED OR EXTENDED BY SALES OR PROMOTIONAL MATERIALS. THE ADVICE AND
STRATEGIES CONTAINED HEREIN MAY NOT BE SUITABLE FOR EVERY SITUATION. THIS WORK IS
SOLD WITH THE UNDERSTANDING THAT THE PUBLISHER IS NOT ENGAGED IN RENDERING LEGAL,
ACCOUNTING, OR OTHER PROFESSIONAL SERVICES. IF PROFESSIONAL ASSISTANCE IS REQUIRED,
THE SERVICES OF A COMPETENT PROFESSIONAL PERSON SHOULD BE SOUGHT. NEITHER THE
PUBLISHER NOR THE AUTHOR SHALL BE LIABLE FOR DAMAGES ARISING HEREFROM. THE FACT
THAT AN ORGANIZATION OR WEBSITE IS REFERRED TO IN THIS WORK AS A CITATION AND/OR A
POTENTIAL SOURCE OF FURTHER INFORMATION DOES NOT MEAN THAT THE AUTHOR OR THE
PUBLISHER ENDORSES THE INFORMATION THE ORGANIZATION OR WEBSITE MAY PROVIDE OR

RECOMMENDATIONS IT MAY MAKE. FURTHER, READERS SHOULD BE AWARE THAT INTERNET
WEBSITES LISTED IN THIS WORK MAY HAVE CHANGED OR DISAPPEARED BETWEEN WHEN THIS
WORK WAS WRITTEN AND WHEN IT IS READ.

For general information on our other products and services or for technical support, contact our Customer
Care Department within the U.S. at (800) 762-2974, outside the U.S. at (317) 572-3993 or fax (317) 572-4002.
Wiley also publishes its books in a variety of electronic formats. Some content that appears in print may not
be available in electronic books.
Trademarks: Wiley, the Wiley logo, Wrox, the Wrox logo, Programmer to Programmer, and related trade
dress are trademarks or registered trademarks of John Wiley & Sons, Inc. and/or its affiliates in the United
States and other countries, and may not be used without written permission. Microsoft SQL Server is a
trademark of Microsoft Corporation in the United States and/or other countries. All other trademarks are
the property of their respective owners. Wiley Publishing, Inc. is not associated with any product or vendor
mentioned in this book.


About the Authors
Paul Turley
Paul is an instructor for Netdesk Corporation in Seattle. As a consultant, he has worked with Microsoft
Consulting Services on enterprise-scale development projects and has created reporting solutions using
Crystal Reports, Active Reports, and Access. Since 1988, he has managed IT projects, designed and
programmed applications using Visual Basic 3, 4, 5, 6, ASP.NET, ADO.NET, and SQL Server. He obtained
his MCSD certification in 1996. Other certifications include MCDBA, IT Project+ and Microsoft Solutions
Framework (MSF) Practitioner.
He designed and maintains www.Scout-Master.com, a web-based service that enables Boy Scout units to
manage their membership and advancement records online using ASP.NET, SQL Server 2000, and
Reporting Services. Paul has been a contributing author on books and articles including Professional
Access 2000 Programming, Beginning Access 2002 VBA, and SQL Server Data Warehousing with Analysis
Services from WROX Press.
My deepest appreciation goes to my wife, Sherri, and our children: Josh, Rachael, Sara, and Krista for

their support and understanding while barricading myself in my office for four months. Thanks to Todd
Shelton, Lance Baldwin, and the rest of the Netdesk team for supporting our efforts and putting up with
this madness.
For their contributions, special thanks to: Tommy Joseph, Disney Internet Group; Andrew Bryan,
Dundas Software; Dennis Higgins, Strafford Technology; Mario Raia, Combined IQ.
Paul Turley contributed Chapters 1, 3, 4, 5, 10, 14, and Appendices D and E to this book.

Todd Bryant
Todd has been creating custom data-focused applications and reporting solutions since the early
eighties. He began using Microsoft technologies in 1998 and the love affair began. Todd has been
contract programming, teaching, and developing custom courseware every since. He is currently
working as a trainer at Netdesk Corporation, where he concentrates on Enterprise Solutions, Com+
Services, and Object Oriented Programming using both VB.NET and C#. His certifications include the
MCSD, MCSE, MCDBA, and MCT certifications from Microsoft, the CNA certification from Novell, and
both CompTIA's A+ and CTT+.
I would like to thank my parents Janice, Gary, and Abby for believing in me. I was not always who I am
today. Secondly, I would like to thank my daughter Ali for putting joy in my life, Christine for showing
me love, and Tommy and Stephanie for teaching me the true meaning of the word compromise. Lastly, I
would like to thank the Lord above who placed so many good people in my life and made all this
possible.
Todd Bryant contributed Chapters 11 and 12 and Appendix C to this book.


James Counihan
James started working with databases and reporting applications when doing research for the
government back in 1979. Since then his program management and development experience has been
primarily in the retail and energy industries. He's been teaching development courses at Netdesk
Corporation in Seattle for the past three years, focusing on integrating LOB applications using Microsoft
application servers and web services.
Thanks to my wife and family. It was only with their understanding and support that I was able to

participate in this project. With my deepest love and appreciation, thank you!
James Counihan contributed Chapters 6 and 8 and Appendix B to this book.

George McKee
George McKee is a Solution Developer for Avanade Inc., a Seattle-based integrator for Microsoft
technology that's a joint venture between Accenture Ltd. and Microsoft. George specializes in the inhouse financial systems of Avanade. He has a degree in Chemical Engineering from Brigham Young
University and has been using computers and databases to resolve technical and business problems for
25 years. George has MCAD and MCSD certifications. When not sitting in front of a computer, George
likes to be found in backcountry skiing in the Washington Cascade Mountains. He can be reached via
email at
I would like to thank my wife Becky for tolerating various forms of computing at meal times and my
physical and mental absence from many family activities while writing this book. My children (George
Jr., Ben, Rosie, and Emily) deserve an honorable mention for patience with my generally distracted
interest in their activities during the production of this book.
George McKee contributed Chapter 13 and Appendix A to this book.

Dave DuVarney
Dave DuVarney is a Senior Consultant at Aspirity, LLC where he provides consulting and training
services in the fields of business intelligence and software development. He brings over 5 years of
finance, programming, and development methodologies experience to high technology business
intelligence solutions. Prior to joining Aspirity, Dave was a development instructor teaching a wide
range of Microsoft technologies. Dave also spent his early career working for a Seattle-based CPA firm.
When Dave is not working, he enjoys running. At the time of publishing, he is training for his first full
marathon.
I would like to thank my wife, Stephanie, for all the love and support she has provided in this process. I
would also like to thank my parents, Marcus and Trudy, for giving me the opportunities that have
helped me succeed in life.
Dave DuVarney contributed Chapters 2 and 9 to this book.



Credits
Authors

Vice President and Publisher

Paul Turley
Todd Bryant
James Counihan
George McKee
Dave DuVarney

Joseph B. Wikert

Executive Editorial Director
Mary Bednarek

Editorial Manager
Acquisitions Editors

Kathryn A. Malm

Sharon Cox
Katie Mohr

Production Editor
Pamela Hanley

Vice President and Executive Group
Publisher


Book Producer

Richard Swadley

Peer Technical Services Pvt. Ltd.

Vice President and Executive Publisher
Robert Ipsen



Foreword
Jason Carlson
Many people have asked me, "How can you be so passionate about reporting when it is so mundane?"
To me the most exciting thing about reporting is that it is so very common. Like basic transportation,
everybody uses it in some way or another. A report is a piece of art, meant to covey a message; but
unlike traditional art, that message changes based on the data driving it. The potential to help, and be
used by, millions of people and companies is one of the reasons I started writing software and
eventually joined Microsoft. No other company can reach out to so many people by making great
products accessible.
Reporting is a very broad topic covering areas ranging from packing lists and telephone bills to ad hoc
analysis and Excel spreadsheets. When designing Microsoft SQL Server Reporting Services, I started
with a simple definition for it: an information delivery platform. While this definition is also very broad,
it did allow us to focus on our design while leaving us significant room to expand in later versions. This
book will help you understand the power of Reporting Services and fully to utilize its capabilities.
Information is not just data; it is data that has been transformed into something meaningful. This
transformation is important. Any tool can read and display data; what people really need for doing their
jobs is well thought out, correct, and pertinent information. There are many tools that allow anyone with
access to data to build "views" or "reports". However, many times these users are unfamiliar with all of
the nuances of the data storage and can produce inaccurate results or inadvertently affect the

performance of the data engine. Reporting Services acts as the official source so that there is only one
version of the truth that everyone uses.
In future, Microsoft plans to take this even further by integrating with Information Rights Management
so that not only does the information come from a single source, but is also certified, can expire, and is
access-controlled even after it is delivered to the end user. The data does not always exist in one
database or even come from a database. For those of us who have spent careers working with corporate
data, this is a painful truth. Very few reports (or sets of reports that give you sufficient insight) come
from a single source. Building some type of data mart or data warehouse is the best solution, but not
always possible due to timing, policy, or budgetary constraints. Reports must be able to retrieve data
from any source and combine them in a single report.
What good is information if you do not have it when you need it? Delivering information is more than
just processing it and making it available; it is providing information when you need it, in any format,
and on any device that you have. The common case today is the ubiquitous online access via HTML in a
browser. This is perfect when you have a computer and connectivity to the server. However, as we all
know, nothing is perfect. We need the reports when we are on a plane, in a car, with the customer, at the
game, on the production floor, etc. This may include your pager, telephone, fax machine, laptop, paper,
and other devices. We also need different capabilities: interactivity, pixel perfect printing, integration
into applications like MS Excel for "What if" scenarios and additional analysis, universal access via PDF,
etc. A single format and a single delivery channel is not enough, but how do you know which ones you


Foreword
will need? Reporting Services insulates you from these choices. All reports may be distributed in any
channel or rendered in any format. Report design is independent of how it will be consumed. It is the
responsibility of the system to provide the report as accurately as possible, given the constraints of the
specific format or channel requested.
Building a platform is very different from building a solution. In fact the goals are in many cases
completely opposed. A platform is successful if the developers and administrators have complete access
to all aspects of the product. They need to be able to optimize, extend, restrict, embed, and replace parts
of the product to meet their needs. This means that all of the APIs are available and documented, all

formats are open and described, and every component is configurable or replaceable. While there are
always restrictions due to the many tradeoffs in software design, this was the goal when building
Reporting Services. Very much like Windows, SQL Server, or Visual Studio, Reporting Services is
designed to enable developers to build on a solid foundation and mold it to meet the business needs in
significantly less time and with more functionality, but without losing the flexibility and power of
building it themselves.
Looking to the future, there's an endless list of features and scenarios that Microsoft will add to make the
platform more powerful with little or no additional in-house development required. I have mentioned
some, and there are many that haven't even been considered yet.
We look forward to hearing from all of our customers about what is important to them and how we can
make designing, building, and operating their information delivery systems easier, faster, and (I hope)
more fun.
Jason Carlson
SQL Server Reporting Services Product, Unit Manager, Microsoft
Jason Carlson is the Product Unit Manager for SQL Server Reporting Services. He joined Microsoft in
1996 as a Program Manger for Visual Source Safe and Repository. In 1997, the Repository team joined
SQL Server and Jason became the development manager for SQL Server Meta Data Services. In 2001,
he built a team and started work on V1 of Reporting Services. Before joining Microsoft, Jason owned
and operated an independent software development company. This company provided consulting and
vertical software solutions for healthcare and telecommunications.
.

x


Foreword
David Cunningham
Agility. In business today, key decisions must be made daily or weekly rather than monthly or quarterly.
Leading companies realize that to increase the speed of competitive response, their corporate agility,
they need to delegate as much decision-making authority as possible to employees on the front lines.

Real-time bidding systems, reverse auctions, accurate costing on spot production, build-to-order
manufacturing, a world-wide labor force, and globalization. These are just a handful of the trends in
today's business climate that demand better decisions faster.
To be successful in this new model, employees need the best quality information they can possibly get.
Information must be accurate, timely, and reliable; and it must be the information they need. Whether
your employees are trying to maximize revenues by intelligently attacking new markets, or minimizing
expenses through astute purchasing, they absolutely must have the right information at their fingertips.
Microsoft's release of SQL Server 2000 Reporting Services marks an important milestone in the world of
business intelligence: information truly accessible to the masses. By building reporting functionality
directly into Microsoft's Enterprise Data Platform, SQL Server 2000, software developers and
information architects can now count on the availability of a high quality, scalable, and robust
architecture on which to build their reporting systems.
For the past 20 years Business Intelligence (BI) has been working its way deeper and deeper into the
Enterprise. Previously, the domain of a handful of highly skilled analysts high in the corporate ivory
tower, BI is now in the hands of line managers, department heads, and knowledge workers at the very
edge of today's organizations.
In the past, dependable reporting systems could be horrendously expensive, with organizations forced
to deploy robust reporting services only where the greatest gains could be realized. Microsoft's longstanding objective of reducing information technology cost to spur adoption is again evident in the SQL
Server 2000 Reporting Services licensing model. This technology is licensed to anyone currently licensed
for SQL Server 2000 and so essentially represents no additional cost. This is a fantastic development for
software developers and users alike; it will dramatically increase the adoption and distribution of
detailed, accurate, and timely reporting and will push quality BI even further down into the Enterprise.
In this excellent book, the authors walk us through SQL Server 2000 Reporting Services from the basics
of practical reporting through deployment and management of reporting solutions written for BI
Solution architects, designers and developers; it is certainly a most valuable resource.
David Cunningham
President & CEO, Dundas Software
Dundas Software has provided charting and graphing technology under license to Microsoft for
inclusion in SQL Server 2000 Reporting Services and is readying additional data visualization
extensions for the next version of SQL Server, code-named 'Yukon'.




Contents
Introduction
Chapter 1: Getting Started with Reporting Services
Who Is This Book for?
Agility
The Way We Were
That Was Then, This Is Now
Business Intelligence and Decision Support
Automation to the Rescue – A Scenario
Challenges of Existing Reporting Solutions
How Does SQL Server Reporting Services Meet This Challenge?
Business Intelligence Solutions
Who Uses Reports and Why?
Executive Leadership
Managers
Information Workers
Customers
Vendors and Partners

Reporting with Relational Data
Reporting for Decision Support
Data Warehouses
The Reporting Lifecycle
Report Delivery Application Types
Web Browser
Office Applications
Programmability

Subscriptions
Report Formats
Importing Data/Exchanging Data

System Requirements
Installing Reporting Services
Setup Options
Adding and Removing Options
Server Components
Client Components
Books Online
Reporting Services Samples
AdventureWorks Database

xxvii
1
2
2
3
4
4
5
6
7
8
8
9
9
9
10

10

10
10
10
11
12
12
12
13
13
13
13

13
15
15
16
16
16
17
17
17


Contents
Administrative Tools
Command Line and Unattended Installation
Log Files
Email Delivery


Designing Reports
Form Reports
Tabular Reports
Groupings and Drill-Down
Drill-Through Reports
Multi-Column Reports
Matrix
Charts
Data Sources
Queries
OLAP Reporting

Using Visual Studio .NET
Report Wizard
The .NET Framework

Custom Reporting Extensions
Data Processing Extensions
Delivery Extensions
Configuration Files
Scripting

Subscriptions
Securing Reports
The Report Manager
Designing Reports
URL Access to Reports
Rendering Reports in Program Code


Report Definition Language
Deploying Reports
Designing and Architecting Report Solutions

Summary

Chapter 2: Reporting Services Architecture
The Reporting Lifecycle
Authoring
Management
Delivery

Reporting Services Features
Visual Studio .NET 2003 Integration
Query Designer
Server Explorer
Visual Source Safe
Report Designer
Report Server Features
Central Report Storage
Security
Report Delivery

xiv

17
18
18
18


18
18
18
19
19
19
19
19
19
19
20

20
20
20

21
21
21
21
22

22
22
23
24
26
26

26

27
27

27

29
30
30
30
31

31
31
31
31
32
32
32
32
32
33


Chapter
Contents
Title
Scheduling
Programming Interface Features
Open Architecture
Complete Access


Report Server Components
Report Processor
Report Request Handling
Report Definition
Intermediate Format
Caching
Session Cache
Cached Instances
Snapshots
Report Processing Illustrated

Data Processing Extensions
Data Processing Defined
Supported Providers
SQL Server Provider
Oracle Provider
OLEDB Provider
ODBC Processing Extension
Data Processing Extensions and Data Providers
Supported Rendering Extensions
Excel
PDF
HTML
Web Archive (MHTML)
CSV
TIFF
XML
Customized Extensions
Scheduling and Delivery Processor

Scheduling
Delivery
Scheduling and Delivery Processor Illustrated
Email
File Share
Custom Extensions
Report Server Databases
ReportServer Database
ReportServerTempDB Database
Viewing Execution Information

The Reporting Services Web Service
Web Services
Open Standards
Visual Studio .NET Integration
Available Features

Report Designer
Visual Studio .NET
Report Definition Language (RDL)

33
34
34
34

34
34
35
35

35
35
35
35
36
36

37
37
37
37
37
37
38
38
39
39
39
39
40
40
40
40
41
41
41
42
43
45
45

45
46
46
47
48

48
48
48
49
49

50
50
50

xv


Contents
Reporting Services Tools
Report Manager
Report Server Command-Line Utility (RS.EXE)

Reporting Services Illustrated
Summary

Chapter 3: Designing Reports
Using the Report Wizard
Establishing a Data Source

Building a Query
Define the Report Structure
Specify the Deployment Location
The Report Designer
Scale Units

Importing Reports
Using RDL
Importing Access Reports

Plan for Extensibility
Browser Compatibility
Offline Viewing
Mobile Device Support

Report Items and Data Regions
Textbox Report Item
Line Report Item
Rectangle Report Item
Image Report Item
Subreport Item
Chart Report Item
Drill-Down and Drill-Through Reports
Tabular Reports
Grouping Data
Table Report Data Region
List Report Data Region
Matrix Report Data Region

Subtotals

Formatting
Standard Formatting
Explicit Formatting
Conditional Formatting
Multiple Columns

Pagination Control
Page Breaks for a Rectangle
Page Breaks for a List
Page Breaks for a Table
Page Breaks for a Group
Page Breaks for a Matrix
Page Breaks for a Chart

Printing Considerations
Summary

xvi

50
50
51

51
52

55
56
57
59

62
63
65
65

68
69
69

69
70
70
71

71
72
73
74
74
76
77
79
80
80
80
80
81

82
85

85
86
88
89

90
91
91
92
92
93
93

93
94


Chapter
Contents
Title
Chapter 4: Designing Data Access
Reporting for Relational Data
A Dataset Is Not a Dataset

Query Basics
Data Sources
Creating a Data Source in the Report Wizard
Creating a Data Source from the Project Add Item Template
Creating a Data Source When Defining a Dataset
Data Sources and Query Languages


Filtering Techniques
Filtering Data with Query Parameters
Report Parameters
Basing a Parameter on a Query
Cascading Parameters
Using Stored Procedures
Filtering Data with Report Parameters

Summary

Chapter 5: Advanced Report Design
Creating a Tabular Report Using a Table
Column Placement and Indentation
Headers and Footers
Drill-Down Reports
Creating a Document Map
Links and Drill-Through Reports
Bookmarks and Links
Drill-Through

Recursive Data
Subreports
Charting
Column Charts
3-D Column Charts
Stacked Column Chart
Area and Line Charts
Pie Charts
Bubble Charts

A Charting Example

Custom Fields
Conditional Expressions
Using Custom Code
Using Custom Code in a Report
Using a Custom Assembly

95
97
97

97
98
98
99
99
100

101
102
103
105
106
112
116

119

121

122
125
126
128
130
132
132
132

134
137
139
141
141
142
142
143
143
144

149
150
151
152
153

Designing for Mobility

156


Screen Size
Offline Solutions

156
158

Summary

159

xvii


Contents
Chapter 6: Managing Reports Using the Report Manager
Introduction to the Report Manager
What Is Report Management?
Understanding the Report Manager
The Report Manager Interface
Navigating the Report Manager Interface
Navigation Tools
Breadcrumb Trail
Tabs and Options Toolbar
Local Menu
Global Toolbar and Details Button
Searching for Folders and Reports
The Report Manager Help
About System Site Settings
Report History Default Settings
Report Execution Timeout

Report Logging
About My Reports

Working with Folders and Reports

161
161
162
162
163
165
165
166
166
166
167
168
168
168
169
169
169
170

171

Creating New Folders
Moving Items into a Folder

171

172

Working with Data Sources

174

Configuring Shared Data Sources
Data Source Credentials
Credentials Supplied by the User
Credentials Stored Securely

Configuring Users and Permissions
About Report Manager Security
Understanding Role-Based Security
Using Report Manager Default Security
Understanding Roles
Understanding Tasks
System Tasks and Item Tasks
Understanding the Predefined Roles
System Administrator
System User
Content Manager
Publisher
My Reports
The Browser Role
Creating a New Role Definition
Understanding Role Assignments
Creating Role Assignments

System Security and Network Considerations

Revoking Access to My Reports
Intranet and Extranet Considerations

Viewing, Executing, and Scheduling Reports
Viewing Reports
Linked Reports
On-Demand Reports and Subscriptions

xviii

175
177
177
178

178
178
179
179
180
180
181
181
182
183
183
184
184
184
185

186
187

189
190
190

191
191
191
191


Chapter
Contents
Title
The Report Execution Process
Providing Report Parameters and Credentials
On-Demand Reports
Caching the Report for Other Users
Creating and Editing Schedules
Snapshot Reports
Creating a Report History
Report Subscriptions
Standard Subscriptions
Data-Driven Subscriptions

Summary

Chapter 7: Managing Reports Using Program Code

Professional SQL Reporting Services Manager
Building the Visual Interface
Adding a Reference to the Web Service
Consuming the Web Service
Filling the Treeview
Credentials
Displaying the Folder Contents
Adding/Updating Folders
Folder Form

Deleting an Item from a Folder
Importing Report Definition Files
Managing Security
Tasks
Roles
Policies
Building the Security Forms
Policy Form
Adding, Editing, and Deleting Security Policies
Adding, Editing, and Deleting Security Roles
RoleForm
Adding, Editing, and Deleting Roles
Role Task Form

Summary

192
193
194
194

196
198
199
200
202
202

203

205
205
207
210
212
215
219
221
223
225

238
240
244
244
244
244
244
244
250
261

261
266
266

275

Chapter 8: Report Scripting

277

Command Line Utilities

277

rsconfig
rskeymgmt
rsactivate
rs

Automating Server and Report Management
Reporting Services RS Utility
RS Utility Command Line Syntax
RS Utility Errors

278
278
279
279

279

280
280
282

xix


Contents
Script Development
Script Format Requirements
Namespaces Available
System
System.IO
System.Xml
System.Web.Services
Reporting Services Web Service

Building a Script Development Harness
Creating the Console Project
Adding Imports Statements
Adding References
Using Conditional Compilation

Accessing Server Items
Creating the Proxy Instance
Passing Variable Values to the Script
Retrieving Items
Building Message Content

Retrieving Reports

Retrieving Report Items
Getting Report Definitions

Deploying Reports
The CreateReport Method
Error Handling

Logging Events
Opening the File
Writing XML Nodes

Running the Script
Scheduling the Script
Summary

Chapter 9: URL Access and Programmatic Rendering
URL Access
URL Syntax
Accessing Reporting Services Objects
Folders
Data Sources
Resources
Reports
Reporting Services URL Parameters
Parameter Prefixes
Parameters
Passing Report Information through the URL
Report Parameters
Rendering Snapshot History
URL Rendering Summary


Programmatic Rendering
Common Scenarios
Custom Security

xx

283
283
283
283
284
284
284
284

285
285
287
288
290

291
291
293
293
293

295
295

296

297
297
298

298
298
299

301
302
305

307
308
308
308
309
309
311
312
312
313
314
318
318
319
319


320
320
320


Chapter
Contents
Title
Server-Side Parameters
Rendering through Windows
Building the Application Interface
Setting Up the Reporting Service Web Service
Retrieving Report Information
Retrieving Report Parameters
Rendering a Report to a File System
Rendering a Report to the File System Summary
Rendering to the Web
Using Integrated Authentication
Modifying the web.config File
Setting Up the Reporting Service Web Service
Rendering to the Response Object
Rendering to the Web Summary

Summary

Chapter 10: Report Caching and Subscriptions
Report Delivery
Caching
Cached Instances
Snapshots

History
Storing Parameters
Parameterized Filters

Configuring Credentials for Data Sources
Storing Credentials
Linked Reports

Configuring Cached Reports
Subscriptions

320
321
321
321
325
328
330
337
337
337
338
339
339
345

346

347
347

347
349
349
349
350
350

351
351
353

353
357

Snapshot-Triggered Subscriptions
Schedule-Triggered Subscriptions
Individual and Shared Schedules
Configuring Email Delivery
File Share Subscriptions
Pocket PC Report File Updates

358
359
359
361
361
363

Data-Driven Subscriptions
Managing Subscriptions

Using the Reporting Service Web Service
Managing Subscriptions Using Script
Summary

363
365
366
375
376

Chapter 11: Report Definition Language

379

RDL – Underlying Technology

379

What Is XML?
XML Naming Rules
XML Elements
XML Attributes
XML Documents
XML Namespaces

380
380
380
381
382

383

xxi


Contents
XML Schema

What Is RDL?
Document RDL
Data RDL
Control RDL
TextBox
Line
Rectangle
Table
Matrix
List
Image
Subreport
Chart

Creating RDL
RDL with .NET
RDL with CodeSmith

Summary

Chapter 12: Extending Reporting Services
Overview

The Missing Pieces
Security Extensions
Rendering Extensions
Extensible Report Designer Classes

Business Opportunities
Common Extension Interfaces
What Is an Interface?
IExtension
IDisposable
Interface Language Differences
Data Processing Extensions

Creating a Custom Data Processing Extension
Creating the Project
Creating the CSVConnection Object
Variable Declarations
Constructors
Implementing IDbConnection
Implementing IDisposable
BeginTransaction Function
CreateCommand Function
Open Method
Close Method
ConnectionString Property
ConnectionTimeout Property
Creating the CSVParameter Class
Declarations
Implementing IDataParameter
ParameterName Property

Value Property

xxii

384

388
390
392
396
396
397
397
397
398
399
399
400
400

401
401
402

409

411
411
412
412

412
413

413
413
414
414
415
415
416

418
418
419
419
420
420
421
421
421
422
422
423
423
424
424
424
425
426



×