Client Side Reporting with Visual Studio in S Sharp
CYAN MAGENTA YELLOW BLACK PANTONE 123 C Books for professionals by professionals ® The EXPERT’s VOIce ® in Reporting Services Companion eBook Available Client-Side Reporting with Visual Studio in C# Covering Versions Covering Versions Thank you for buying this book I wrote it as a reference to developing stunning client-side reports step-by-step using Visual Studio I sincerely hope that you will enjoy each featured reporting project I further hope that this book will be your tool to master the craft of professional report development This book covers the 2005 and 2008 releases of Visual Studio I wanted to give you a single point of reference to create reports with all clients that are available for development using the Visual Studio IDE All examples in this book are based on real-world experience Whether you need to create a travel itinerary or a complex chart of accounts, you’ll see all sorts of interesting reporting patterns in action There are many books available on the server-side aspects of reporting services (RS) However, there are no references available that address client-side features of RS, and the overwhelming response I received for some of my articles on that topic compelled me to take on this book project I tried my best to address common challenges faced by all of us, whether beginner or seasoned report developers If you consider yourself in the professional category, you can jump to any chapter of your interest However, if you are a newbie, please go through all the chapters sequentially I’m a big fan of listening to my readers’ comments Therefore, please let me know your thoughts; I’m always eager to hear them Finally, I hope you’ll find all the answers to your queries in the contents of this book Happy reporting! Asif Sayed Related Titles Companion eBook See last page for details on $10 eBook version www.apress.com ISBN-13: 978-1-59059-854-2 ISBN-10: 1-59059-854-7 54999 US $49.99 Sayed SOURCE CODE ONLINE Client-Side Reporting with Visual Studio in C# Dear Reader, 2005 and 2008 Using C# Client-Side Reporting with Visual Studio in C# Prepare for tomorrow by learning real-world practical reporting projects today! Asif Sayed Shelve in NET User level: Intermediate–Advanced 781590 598542 this print for content only—size & color not accurate spine = 0.939" 496 page count 8547FMfinal.qxd 8/30/07 3:34 PM Page i Client-Side Reporting with Visual Studio in C# Asif Sayed 8547FMfinal.qxd 8/30/07 3:34 PM Page ii Client-Side Reporting with Visual Studio in C# Copyright © 2007 by Asif Sayed All rights reserved No part of this work may be reproduced or transmitted in any form or by any means, electronic or mechanical, including photocopying, recording, or by any information storage or retrieval system, without the prior written permission of the copyright owner and the publisher ISBN-13 (pbk): 978-1-59059-854-2 ISBN-10 (pbk): 1-59059-854-7 Printed and bound in the United States of America Trademarked names may appear in this book Rather than use a trademark symbol with every occurrence of a trademarked name, we use the names only in an editorial fashion and to the benefit of the trademark owner, with no intention of infringement of the trademark Java™ and all Java-based marks are trademarks or registered trademarks of Sun Microsystems, Inc., in the US and other countries Apress, Inc., is not affiliated with Sun Microsystems, Inc., and this book was written without endorsement from Sun Microsystems, Inc Lead Editors: Jim Huddleston, Jeff Pepper Technical Reviewer: Ty Anderson Editorial Board: Steve Anglin, Ewan Buckingham, Gary Cornell, Jonathan Gennick, Jason Gilmore, Jonathan Hassell, Chris Mills, Matthew Moodie, Jeffrey Pepper, Ben Renow-Clarke, Dominic Shakeshaft, Matt Wade, Tom Welsh Project Manager: Kylie Johnston Copy Edit Manager: Nicole Flores Copy Editor: Heather Lang Assistant Production Director: Kari Brooks-Copony Production Editor: Ellie Fountain Compositors: Dina Quan and Linda Weidemann Proofreader: Nancy Riddiough Indexer: Carol Burbo Artist: Kinetic Publishing Services, LLC Cover Designer: Kurt Krames Manufacturing Director: Tom Debolski Distributed to the book trade worldwide by Springer-Verlag New York, Inc., 233 Spring Street, 6th Floor, New York, NY 10013 Phone 1-800-SPRINGER, fax 201-348-4505, e-mail orders-ny@springer-sbm.com, or visit http://www.springeronline.com For information on translations, please contact Apress directly at 2855 Telegraph Avenue, Suite 600, Berkeley, CA 94705 Phone 510-549-5930, fax 510-549-5939, e-mail info@apress.com, or visit http://www.apress.com The information in this book is distributed on an “as is” basis, without warranty Although every precaution has been taken in the preparation of this work, neither the author(s) nor Apress shall have any liability to any person or entity with respect to any loss or damage caused or alleged to be caused directly or indirectly by the information contained in this work The source code for this book is available to readers at http://www.apress.com in the Source Code/ Download section 8547FMfinal.qxd 8/30/07 3:34 PM Page iii This book is dedicated to the late James Huddleston (the initial editor of this book) and to my loving family and friends who provided the support, love, and encouragement that made this endeavor possible 8547FMfinal.qxd 8/30/07 3:34 PM Page iv 8547FMfinal.qxd 8/30/07 3:34 PM Page v Contents at a Glance About the Author xvii About the Technical Reviewer xix Acknowledgments xxi Introduction xxiii s CHAPTER s CHAPTER s CHAPTER s CHAPTER s CHAPTER s CHAPTER s CHAPTER s CHAPTER s CHAPTER s CHAPTER 10 s CHAPTER 11 s CHAPTER 12 s CHAPTER 13 s CHAPTER 14 s CHAPTER 15 s APPENDIX What Is Client-Side Reporting? Client-Side Reporting Components 23 Data Models, Datasets, and the ADO.NET Interface 51 Reporting with Windows Forms 75 Reporting with ASP.NET Web Forms 147 Reporting with Web Services and Mobile Devices 227 Reporting with a Console Application 253 Reporting with a Windows Service 285 Reporting with Web Parts 309 Reporting on Other Data Sources 329 Integrating Server-Side Reports 359 Moving from Crystal Reports to Reporting Services 369 Using Third-Party Tools and Having Fun with RS 385 Reporting with Visual Studio 2008 Windows Forms 407 Reporting with Visual Studio 2008 Web Forms 431 The Visual Studio 2005 IDE 443 s INDEX 455 v 8547FMfinal.qxd 8/30/07 3:34 PM Page vi 8547FMfinal.qxd 8/30/07 3:34 PM Page vii Contents About the Author xvii About the Technical Reviewer xix Acknowledgments xxi Introduction xxiii s CHAPTER What Is Client-Side Reporting? Reporting Dynamics Client-Side Architecture Client-Side Architecture Characteristics Server-Side Reporting Architecture Users Customers Vendors Executives and Managers Line Managers Everyone Else What Applications Are Supported? Windows Forms Web Forms Web Services Windows Services The Report Creation Process Designing the Report Layout Connecting to the Data Source Binding the Data to the Report A Real-World Report in Action! 10 A Hands-On Approach 11 Challenge: Defining the Reporting Project 11 Process: Applying the Three Steps in Developing a Report 12 Practice: Enhancing Your Understanding with Exercises 13 vii 8547FMfinal.qxd viii 8/30/07 3:34 PM Page viii sCONTENTS Report Structure 14 Header 15 Body 15 Footer 16 Creating Better Reports 17 Report Patterns 17 The Form/Page Pattern 18 The Tabular Details Pattern 18 The Multicolumn Pattern 19 The Grouped Data Pattern 19 The Matrix/Pivot Pattern 20 The Chart/Graph Pattern 21 The Drill-Through Pattern 21 The “As You Like It” Pattern 21 Summary 22 s CHAPTER Client-Side Reporting Components 23 Report Designer 24 Report Design Surface 26 Adding Headers and Footers 26 Report Properties 26 Report Parameters 28 Report Items 29 Pointer 30 Textbox 30 Line 32 Table 33 Matrix 34 Rectangle 35 List 35 Image 36 Subreport 37 Chart 38 Formatting Output 39 Format Dialog Box 39 What Are the Most Common Formats? 40 Beautification 42 Fonts 42 Colors 43 Text Alignment and Decoration 43 8547FMfinal.qxd 8/30/07 3:34 PM Page ix sCONTENTS Expression Editor 44 Conditional Formatting 46 Report Data Source 46 ReportViewer Control 47 Why Do We Need ReportViewer? 48 Zoom Mode 48 Report Export Choices 49 Summary 49 s CHAPTER Data Models, Datasets, and the ADO.NET Interface 51 Working with a Real-World Sample Database 51 Understanding the Data Model 51 Attaching the RealWorld Database 52 Gathering Data into a Dataset 55 What Is a Dataset? 55 Creating a Typed Dataset Manually 56 Creating a Typed Dataset Using the Wizard 61 Creating the ADO.NET C# Interface Code 68 What Is ADO.NET? 68 Getting to Know the Data Provider 69 Writing the C# Interface Code 69 Summary 73 s CHAPTER Reporting with Windows Forms 75 Windows Forms 101 75 Creating a Windows Forms Project 76 Adding the ReportViewer to the Form 78 Adding a Dataset to the Project 80 Building the Project 82 Using This Project As a Template 83 Your First Reporting Project Is on Its Way 83 Product List Reorder Point Report 84 Business Case 85 Selecting the Primary Report Items 85 Creating a Windows Forms Project 85 Step 1: Creating a Data Table 86 Step 2: Designing the Report Layout 89 Designing the Page Header and Footer 93 Designing the Body Section 97 ix 8547appAfinal.qxd 8/30/07 4:18 PM Page 451 APPENDIX s THE VISUAL STUDIO 2005 IDE Figure A-9 The Toolbox window Properties The third window that I’d like to discuss in this section is Properties As you can see in Figure A-2, the Properties window is docked on the right side of the IDE with the Solution Explorer window You can use the Properties window to access the individual characteristics related to specific elements of the project; the element could be a form, file, class, or control As Figure A-10 shows, all associated properties of Form1 are displayed as content in this window You can set the properties’ values inside the window You can view properties according to their categories or sort them alphabetically In Figure A-10, properties are alphabetically sorted Which is better, sorting by category or sorting alphabetically? Well, that choice is different from developer to developer I personally like the alphabetically sorted view But if you like to see all the appearance-related properties, such as color and fonts, together, the categorized view is best for you 451 8547appAfinal.qxd 452 8/30/07 4:18 PM Page 452 APPENDIX s THE VISUAL STUDIO 2005 IDE Figure A-10 The Properties window The first two buttons in the Properties window toolbar are used to toggle between the categorized and alphabetically sorted views The next two buttons on the toolbar are used to toggle between viewing properties or events (the lightening bolt icon) The events view is similar to the properties view in that you can sort events either alphabetically or by group The last button on the toolbar displays the property pages associated with the currently selected item If the item does not have property pages, this button will be disabled s Note The Properties window is smart If you select an item that has no event, the events button will be disabled The bottom of the Properties window has a section for the description of the currently selected property In Figure A-10, the text property is described You can hide the description pane if you want to use the space occupied by it by right-clicking anywhere in the window and unchecking the description setting You can change properties in one of the two ways Certain properties can be changed by clicking on the property name For example, the enabled property has a true/false value If you click this property, you will toggle the value to either true or false Some properties, like text, you can simply select and type in the value 8547appAfinal.qxd 8/30/07 4:18 PM Page 453 APPENDIX s THE VISUAL STUDIO 2005 IDE Working Space All right, you have seen the important windows that are used to manage the solution, work with properties, and access project elements Now, what about the actual work itself? I mean to say, where you design your form and write code? Well, as Figure A-11 shows, all available space in the IDE aside from the windows is actual workspace for you to manage project content You’ll notice in Figure A-11 that we have three open tabs: one is the form designer; another has code behind it, and the third is the Start Page tab, which is the welcome page of the Visual Studio 2005 IDE Figure A-11 Working space So, as you go on working with the project, if you open new files, they will be added to this working space as tabs You can switch to a new tab by clicking the downward facing arrow icon next to the “X” sign (see Figure A-11) s Note An asterisk (*) will appear on a tab to indicate that the contents of the tab (either the form or the code) have changed and are not yet saved Other Windows Within the IDE In addition to all the windows we discussed so far, the IDE contains a few other useful windows Many things in the IDE are contextual; they differ depending on the current mode That means certain windows are only meaningful in design-time mode and others in run-time mode For example, as Figure A-12 shows, if your code results in some error, the error will appear in the Error List window Another example is the Output window, which will show the most recent output of the last performed action of the IDE 453 8547appAfinal.qxd 454 8/30/07 4:18 PM Page 454 APPENDIX s THE VISUAL STUDIO 2005 IDE Figure A-12 The Error List window If you need more information on the IDE, you can find details here: http:// msdn2.microsoft.com/en-us/library/h8w79z10(VS.80).aspx 8547indexfinal.qxd 8/30/07 3:33 PM Page 455 Index s Numbers and symbols = (equals sign), starting expressions with, 44 s A Accounting Reports Pack, using Trial Balance report from, 361 Add New Item dialog box adding and naming new report in, 238 adding CR report in, 374–375 adding dataset to project in, 80–81 adding RS report in, 374 Add Reference dialog box, 241–243 Add Web Reference dialog box, 245 AdddtChartRow() method, 327 AddressList project See also Customer Address List report adding dataset and ReportViewer, 108 building, 115 creating data table, 108–109 designing report layout, 109–113 property settings, 108 writing C# code, 113–115 ADO.NET, creating code for C# interface, 68–72 data models, datasets, and interface, 51–73 Aged Accounts Receivables report adding data group and document map, 159–160 adding header and footer, 161 adding dataset and ReportViewer to, 155–156 adding header, 157 body section table item properties, 162 building the project, 165–167 business case, 154 characteristics for, 153–154 creating a data table, 156 creating, 153–167 designing body section, 158–162 designing layout, 156–162 designing page header, 158 Excel view of document map, 165–166 getting web site ready, 155–156 highlighting invoices over ninety days old, 162 mapping data table columns to text boxes, 159 output in Firefox browser, 165 PDF view of document map and report data, 166 report item properties for header, 158 setting up the page, 157 writing C# code for, 163–164 AJAX (Asynchronous JavaScript and XML), 148 Alphabetical List of Products report, from sample MS Access database, 331 App_Code folder, in RSWebSite101 project, 149 Arabic language support, 217 “as you like it” report pattern, 21 ASP NET, Web Sites 101, 147–153 ASP NET web service project, creating, 228–230 ASP NET Web Site, creating, 433 s B Barcode Professional software creating report with, 386–398 web site, Barcode project adding dataset and ReportViewer, 388–389 adding header, 390 adding interactive sorting, 395–396 creating, 386–398 creating GetBarcode function, 394–395 designing, 391–395 GetBarcode function for, 392–394 image item properties, 392 property setting for, 389 reference to barcode assembly, 392–393 writing C# code, 396–398 body section See also individual reports adding group to, 263–264 contents for reports, 15–16 designing for MS Access project, 336–338 designing for Oracle project, 354 designing for console application, 263–264, 275–277 designing for XML project, 346–347 in reports, 14 books catalog report, using XML, 342 Books Year to Date Sales report adding CrystalReportViewer to, 372 adding dataset and ReportViewer, 371 455 8547indexfinal.qxd 456 8/30/07 3:33 PM Page 456 sINDEX adding header and footer, 376 building the project, 382 creating data table, 373–374 designing body section for, 378–380 designing layout of, 374–380 property settings for project, 372 setting up the page, 376–377 Windows Forms Project for, 371–372 writing C# code, 380–382 books.xml file, web site, 341–342 BooksInfo table, selecting to create dataset, 66–67 Branch Sales Performance Chart, 317 beautifying the report, 324 building the project, 327 business case, 317 characteristics, 316–317 Chart Properties dialog box, 323 creating, 316–327 customizing chart report item, 321–323 report item properties, 320–321 business object collections, creating, 179–181 Business Objects, 369 Crystal Reports (CR) from, business-to-business (B2B), business-to-consumer (B2C), s C C# code AddressList project, 113–115 Aged Accounts Receivable project, 163–164 Chart of Accounts report (Arabic), 225–226 Chart of Accounts report (English), 214–216 console applications, 265–269, 277–281 default.aspx page, 325–327 DivisionSales project, 138–139 dsItinerary project, 241–243 for getting MS Access data, 338–340 MyDashboard project, 403–405 NetIncomeComparison report, 187 NewComplaints report, 302–306 Oracle project, 354–357 Product Drill-Down by Category report, 440–441 Product Information and Inventory Status report, 202–205 Product Profitability report, 417–419 Product Reorder project, 102–105 Reporting with VS 2008 Web Forms, 431–441 XML project, 347–348 Chart item, in Report Items Toolbox, 38 Chart of Accounts report (Arabic) building the project, 226 characteristics for, 216 creating, 216–226 creating the web site project, 219 designing body section, 222–224 designing layout, 220–226 getting the web site ready, 217–220 setting up parent/child relationship, 224 setting up the page, 221 table item properties for body section, 223–224 translating from English to, 216–217 writing C# code for, 225–226 Chart of Accounts report (English) adding dataset and ReportViewer, 207–208 adding header, 209 building the project, 216 business case, 207 characteristics for, 206 creating, 206 designing layout, 209–214 designing page header, 209 getting the web site ready, 207–208 setting up parent/child relationship, 212–214 setting up the page, 209 writing C# code for, 214–216 Chart Properties dialog box, Branch Sales Performance Chart, 323 chart/graph report pattern, 21 ChartOfAccountsArb, creating, 219–220 Choose Format dialog box, 39–40 client-side reporting, 1–22 building project for, 256 designing report layout, 260–265 dynamics of, 250 code view, switching to, 290 colors, beautifying reports with, 43 Command objects, ADO.NET, 69 command prompt, starting console applications from, 253 Community menu, VS 2005 IDE, 446 conditional formatting, 46 Connect to Server dialog box, 52 Connection object, ADO.NET, 69 console applications adding a reference to, 265–268 basics of, 253–256 building the project, 256, 269–270 creating a project, 254–255, 258–259 Customer E-mail List by Country report, 257–270 getting host client ready, 258–259, 272 in run-time mode, 257 reporting with, 253–284 8547indexfinal.qxd 8/30/07 3:33 PM Page 457 sINDEX s D Daily Vendor PO Summary report beautifying, 277 building and scheduling the project, 282–283 business case, 271–272 characteristics for, 270–271 creating, 270–277 creating the data table, 273 getting host client ready, 272 sending to vendors FTP site, 271–272 dashboard See also MyDashboard project creating personal, 398–405 getting Windows Forms application ready, 399–400 data group, adding character as, 337 data grouping, 299 data model, understanding, 51–52 Data Output section, Properties dialog box, 28 data provider, understanding, 69 Data Report Designer, data sources for client-side reporting, connecting to for reports, exploring, 329–330 Data Sources toolbox accessing, 260 in Reporting Services, 375 Data Sources window, 89 data table See also individual report names adding columns to, 273 adding grouping to, 299 adding to ProductReorder project dataset, 86–87 adding to Saleschart web site, 318–319 columns to add to, 260 creating for AddressList project, 108–109 creating for CustomerEmail project, 259–260 creating for Daily Vendor PO summary report, 273 creating for Oracle project, 352 creating for Windows Forms project, 59–61 creating for XML project, 344–345 inside the dataset, 61 mapping columns to text box report items, 263 table item properties, 300 database node, after attaching RealWorld database, 54 DataReader object, ADO.NET, 69 dataset adding data table to, 259–260, 333–334 adding to console application, 255 adding to CustomerEmail project, 259 adding to Product Profitability report, 409–411 adding to project, 55–56, 434 creating for reporting projects, 12–13 gathering data into, 55–61 page of MSDN web site, 13 DataSet designer surface accessing, 86 creating data table in, 59–61 Dataset Wizard, creating typed dataset with, 61–67 date formats, standard in report designer, 41 “debug not enabled” information dialog box, 315 debugging, enabling for RSWebSite101 project, 152 Debugging Not Enabled dialog box, 152 Default.aspx page adding ReportViewer to, 150 adding web part functionality to, 311 customizing, 318 writing C# code for, 325–327 DisplayName property, serviceInstaller1, 288 Find it faster at http://superindex.apress.com/ starting, 253 starting in run-time mode, 269 troubleshooting, 283–284 user interaction with, 255–256 writing C# code, 265–269, 277–281 Console class, 256 Console.Read() function, 256 Count() function, 435 cross-tab report pattern, 20 Crystal Reports (CR), after adding header, footer, and body sections, 376, 380 comparing to Reporting Services, 370–382 Microsoft support for, 369–370 moving to Reporting Services from, 369–383 Crystal Reports Gallery dialog box, 375 CrystalReportViewer, 372 Ctrl+Alt+X, viewing toolbar items with, 25 Customer Address List report business case, 107 characteristics for, 106–107 creating, 106–115 Customer E-mail List by Country report business case, 258 characteristics for, 257 CustomerEmail project, creating, 258–259 CustomerEmail.exe file, location on local drive, 270 457 8547indexfinal.qxd 458 8/30/07 3:33 PM Page 458 sINDEX DivisionSales project adding dataset and ReportViewer to, 132–133 building matrix report project, 140 creating, 132–133 writing C# code for, 138–139 Divisionwise Five Years’ Sales Performance report business case for, 131 characteristics for, 130 creating, 130–140 creating Windows Forms project for, 132–133 using matrix feature for, 131–132 document map, 160 drill-down report pattern, 20 drill-through report pattern, 21 dsAgedAR, creating, 155–156 dsChartOfAccounts adding to English Chart of Accounts report, 207 creating data table, 208 dsComplaint dataset, adding to project, 295 dsCreditLimit dataset, creating, 58 dsDivisionSales dataset, 133 dsItinerary project beautifying the report, 240–241 building the web service, 243–244 creating, 235–248 creating Invoke button, 247 designing report layout, 238–241 setting text box values in, 239–240 writing C# code for, 241–243 dsProductInventory data mapping, 194 dataset, 190–191 dsSalesAnalysis, adding to Sales Profit Analysis report, 169 dsTransfer dataset, adding, 117–119 dsTransferDetail table, creating, 119 dsTransferHeader data table, creating, 118 dtAccess data table, creating and adding columns to, 333–334 dtAddressList, adding columns into, 109 dtAgedAR, adding columns to, 156 dtBarcode data table, 390 dtChart data table, adding to Saleschart web site, 318–319 dtChartOfAccounts, adding columns to, 208–209 dtCreditLimit data table, adding columns to, 60 dtInventoryStatus, adding data columns to, 192 dtProductDrilldown data table, creating, 435 dtProductInformation, adding data columns to, 192 dtProductProfit data table, creating, 411–412 dtProductReorder table, adding columns to, 87–88 dtRSandCRs data table, 374 dtSalesAnalysis, adding to Sales Profit Analysis report, 170 dtXML data table, creating and adding columns to, 344–345 Dundas Software, 38, 385 s E Edit Chart Value dialog box, 323 Edit menu, VS 2005 IDE, 445 EmailTo setting, adding to Windows Service project, 301 EmbeddedImages property, setting for dsItinerary report, 238–240 Error List window, VS 2005 IDE, 453 exercises, chapter 4, 143–145 explicit formats, 41 Expression Editor, 44–46 expressions, scenarios for which they can be created, 44–45 s F Field Explorer toolbox, in Crystal Reports, 375–376 File menu, VS 2005 IDE, 445 Font and Format sections, in Textbox Properties dialog box, 31 fonts, beautifying reports with, 42 footer, in reports, 14, 16 form/page report pattern, 18 Form1.cs, writing code for, 69–72 Format dialog box, 39 formatting, conditional, 46 FTP site, sending reports to vendors, 271–272, 281 s G GAC (global assembly cache), registering barcode assembly to, 386 General Properties tab, of Properties dialog box, 27 General tab, Textbox Properties dialog box, 31 generic collections, web site for information, 181 GetBarcode function creating custom, 394–395 writing for Barcode project, 392–394 Google Translate, for translating English to Arabic, 217 8547indexfinal.qxd 8/30/07 3:33 PM Page 459 sINDEX group header, adding title to, 338 grouped data report pattern, 19 Grouping and Sorting Properties dialog box, 437 s H s I IIS (Internet Information Services) as Windows web services host, 228 needed as ASP NET web site host, 148 Image option, in Report Items Toolbox, 36 images, handling embedded in reports, 323–324 IncomeByCountry class, adding to Net Income Comparison report, 180–181 installutil.exe utility, 292 Interactive Sort tab, Textbox Properties dialog box, 31 interactive sorting, adding to Barcode project, 395–396 Invoke button creating for travel itinerary project, 247 web services, 233–234 items property values, inside table1, 439–440 Itinerary table, RealWorld database, 52 s JK JET relational database engine, 330 s L Layout tab, Properties dialog box, 27 LEFT() function, 338 Line item, Report Items Toolbox, 32 link, in drill-through reports, 21 List item, Report Items Toolbox, 35 live news feed, creating dashboard project for, 399–405 s M Matrix item, Report Items Toolbox, 34 matrix/pivot report pattern, 20 menus, VS 2005 IDE, 445–446 Microsoft Access data See MS Access data Microsoft Help, web site for, 228 Microsoft.Reporting.WebForms, adding a reference to, 241–268 mobile devices, reporting with, 248–250 mobile-device applications, by Visual Studio, 249 MS Access data, reporting with, 330–341 MS Access report layout See report layout multicolumn report pattern, 19 MyDashboard project, 398–405 adding dataset and ReportViewer to, 400 building the project, 405 creating data table, 400 designing layout, 401–403 getting Windows Forms application ready, 399–400 making news title a link, 402–403 property settings, 400 writing C# code, 403–405 MySQL with ADO.NET, reporting from, 330 s N namespace, for web services, 230 Navigation tab, Textbox Properties dialog box, 31 Neodynamic barcode software by, 386 web site, Neodynamic.ReportingServices.Barcode class, 394 nested grouping, 299 NET assemblies, information web site, 79 NET Compact framework, 250 Net Income Comparison report adding 3-D effects to, 185–186 adding ReportViewer to, 178–179 building the project, 187 business case, 178 characteristics for, 177–178 creating, 177–187 designing report layout, 181–187 getting ObjectDataSource ready, 187 getting the web site ready, 178 report item properties, 183 specifying plot data for chart, 184–185 writing C# code for, 187 NetIncome.cs class, 179–180 NetIncomeChart, 178 New Complaints report building the project, 307 business case for, 294 Find it faster at http://superindex.apress.com/ header See also page header adding to report layout, 334 adding to reports, 260–261 in reports, 14–15 report item properties for, 274–275 report items for, 262 header and footer adding to report designer, 26 Books Year to Date Sales report, 377–378 report item properties, 97 resizing, 91 Help menu, VS 2005 IDE, 446 Home Decorations, Incorporated, New Complaints report, 293–307 HTML code, adding ReportViewer to Default.aspx page, 150–151 459 8547indexfinal.qxd 460 8/30/07 3:33 PM Page 460 sINDEX creating, 293–307 creating data table, 296 designing layout, 296–302 getting Windows service ready, 294–295 report characteristics, 293 setting up the page, 297 table item properties, 300 writing C# code, 302–306 New Project dialog box creating Windows Service project, 286–287 selecting project type, 254 New Web Site dialog box creating ASP NET web site in, 148–150, 155 naming web site in, 310 selecting ASP NET Web Site in, 310 selecting template in, 228 NewdtChartRow() method, 327 Northwind sample database, downloading, 330 numeric formats, standard in report designer, 40–41 s O Object Explorer, attaching database from, 53 ObjectDataSource, adding to Net Income Comparison report, 182 OnStart/OnStop methods, default code for, 290–291 Oracle 10g Express Edition (XE), downloading installation package, 349 Oracle data, reporting on, 349–357 Oracle project adding dataset and ReportViewer, 351–352 adding header to, 353 building, 357 creating data table, 352 creating Windows Forms project, 351–357 designing body section, 354 designing page header, 353 designing report layout, 352–354 property settings, 118 report item properties for header, 353–354 setting up the page, 353 unlocking human resources sample schema, 350 web site, 349 writing C# code for, 354–357 Orcas, VS 2008 code name, 407 Output window, VS 2005 IDE, 453 s P page, setting up for reports, 261, 274 page and printer setup, Books Year to Date Sales report, 376–377 page header See also header designing, 261–262, 274–275 for MS Access project, 335 report item properties for, 335–336, 346 XML project, 345–346 patterns, commonly used for reports, 17–21 personal dashboard See dashboard Pointer item, in Report Items Toolbox, 30 Preview feature, for previewing and exporting reports, Product Drill-Down by Category report adding dataset and ReportViewer to, 434 adding header, 436 building the project, 441 business case for, 432 characteristics, 431 creating, 431–441 creating data table, 435 designing body section, 437–440 designing layout, 435–440 designing page header, 436–437 getting ASP NET web site ready, 433–434 setting up the page, 436 writing C# code, 440–441 Product Information and Inventory Status report building the project, 205–206 characteristics for, 188–189 creating, 188–206 creating data tables, 191–193 designing report layout, 193–202 drill-through product number report, 188–189 filtering inventory status table data, 196–197 getting the web site ready, 190–191 using drill-through feature, 189 writing C# code for, 202–205 Product List Barcode report, creating, 386–398 Product List Reorder Point report, 84–85 Product Profitability report adding chart report item to list1, 415–416 adding dataset and ReportViewer, 409–411 adding group to list item, 416 adding header, 412 building the project, 419 business case, 409 characteristics for, 408–409 creating data table, 411–412 designing body section, 414 designing layout of, 412–416 designing page header, 413–414 developing in VS 2008, 407–419 getting Windows Forms application ready, 409–411 8547indexfinal.qxd 8/30/07 3:33 PM Page 461 sINDEX s R RDL vs RDLC, RDLC file, text box item stored in, 3–4 rdlc filename extension, rdlc files, publishing on server side, 360 Read() method, 255 ReadLine() method, 255 RealWorld database attaching, 52–54 diversity of data model, 51–52 gathering and working with data, 51–73 mdf and ldf files in folder, 51 with source code for book, 13 RealWorldDataset configuration file, 66 deleting TableAdapter from, 67 Rectangle option, in Report Items Toolbox, 35 reference, adding to project, 265–268 See also Microsoft.Reporting.WinForms reference References section, of Properties dialog box, 27 remote processing mode, 359–360 Render method, 306 producing report output with, 243 report data source, 46 Report Definition Language (RDL), 3–4 report designer accessing report properties, 26–28 adding headers and footers, 26 adding to a project, 24 after adding header, footer, and body, 276, 347 commonly used formats, 40–41 formatting output from, 39–41 introduction to, 24–29 layout of, 25 standard formats, 41 surface for designing reports, 26 with completed header section, 263 with nested data grouping, 299 with Page Header and Body sections, 261 report item properties MS Access project page header, 335–336 New Complaint Report, 298 Oracle project header, 353–354 XML report, 346 report items, 29–38 text alignment and decoration properties, 44 setting color properties for, 43 Report Items toolbox report items in, 29–30 starting travel itinerary report from, 238–240 report layout adding header to MS Access project, 334 adding header to XML project, 345 designing for MS Access project, 334–338 designing for Oracle project, 352–354 designing for XML project, 345–347 Report Manager, using for server-side reports, 359 report parameters, 28–29 for client-side reporting, Report Properties dialog box accessing report properties in, 26–28, 91 Layout tab in, 92–93 Report Wizard choosing a data connection in, 422–423 choosing table styles in, 426–428 creating group inside table report item, 426 creating Reports Application project with, 419–429 data source dialog box, 421–422 developing VS 2008 report with, 419–429 naming connection string in, 423 Find it faster at http://superindex.apress.com/ hiding the legend, 415–416 page header report item properties, 413–414 property settings, 410–411 setting up the page, 412 text box values inside list1, 414 writing C# code, 417–419 ProductReorder project accessing load event for Form1, 102–105 adding columns to data table, 87–88 adding dataset and ReportViewer to, 85–86 adding report to, 89 building the project, 105–106 creating, 85 creating data table, 86–89 designing layout of, 89–93 property settings, 85–86 writing C# code, 102–105 Program.cs, sample code for, 256 project installers default code for, 291 web site for information, 289 ProjectInstaller.cs file, in Windows Service project, 287 Properties dialog box, 27–28 Properties window, VS 2005 IDE, 447, 451–452 Purchase Order Summary report See Daily Vendor PO Summary report 461 8547indexfinal.qxd 462 8/30/07 3:33 PM Page 462 sINDEX selecting report type, 424–426 selecting table layout, 426 welcome dialog box, 420–421 reporting projects, developing using other data sources, 329–357 Reporting Services (RS) after adding header, footer, and body sections, 379 comparing to Crystal Reports, 369–383 integrating third-party tools with, 385–398 introduction of, 1–2 matrix feature, 131–132 subreport feature, 117 using multicolumn capabilities of, 107 using third-party tools with, 385–405 reporting services Properties window, 95–97 reports See also client-side reporting adding header and body sections to, 260–261 adding header and footer to, 15, 273 adding parameters to, 275–276 applying three steps in developing, 12–13 beautification of, 42–44, 265, 277 binding data to, body content for, 15–16 changing item properties, 262 commonly used patterns for, 17–21 connecting to data source, creating better, 17–21 creation process, 8–9 defining reporting project, 11–12 designing body section, 263–264, 275–277 designing layout, 9, 13, 260–265, 273–277 developing to satisfy customers, hands-on approach, 11–13 line managers needs for, producing PDF output, 269 real-world example in action, 10 sending to vendor’s FTP site, 281 setting up the page, 261, 274 structure of, 14–16 support for developing international, 10 vendor’s needs for, writing C# code to populate dataset, 13 Reports Application project, creating, 419–429 ReportViewer control, 47–49 adding to Default.aspx page, 150–151 adding to Product Profitability report, 409–411 adding to project, 434 adding to Sales Profit Analysis report, 169–170 adding to WebPartZone, 312–315 adding to Windows Forms project, 78–79 adding to WinServerSide project, 364 for binding report to client, 13 export options of, 49 how reports display in, 359 need for, 48 print functionality in VS 2005, 151 report export choices, 49 report results presented by, setting up properties for, 365–367 used with a Windows Forms client, 47 zoom settings in, 49 ReportViewer Properties window, for serverside reports, 361 reportViewer1, setting properties for, 78–79 rptAddressList.rdlc See also AddressList project adding report items, 111 changing body section Size property, 109–110 designing report layout, 109–113 mapping table columns to text box report items, 111 report item properties for header, 111–113 setting up the page, 110–111 rptDivisionSales.rdlc adding division subtotals for, 135–136 data mapping from data table, 135 designing layout, 133–137 matrix item in, 134, 136–137 setting year of operation subtotal for, 135–136 setting up the page, 134 rptInventoryStatus.rdlc designing body section, 194–197 designing report layout, 193–194 setting up the page, 194 rptNetIncomeChart.rdlc, 182 rptProductInformation.rdlc adding header, 197 adding parameter, 201–202 designing layout, 197–202 getting drill-through feature working, 200–201 report item properties for header, 198–199 setting up the page, 197 rptProductReorder.rdlc adding column to table item, 99 adding header and footer, 90–91 adding to ProductReorder project, 89 arranging content of table items in, 100 beautifying, 102 designing body section, 97–101 designing page header and footer, 93–97 moving a table, 99 report items for footer, 93 setting up the page, 91–93 table item properties, 100–101 8547indexfinal.qxd 8/30/07 3:33 PM Page 463 sINDEX s S Sales Profit Analysis report building the project, 176 business case, 168–169 characteristics for, 167–168 creating, 167–176 designing layout, 170–175 getting the web site ready, 169–170 writing C# code for, 175–176 Saleschart web site creating, 317–319 designing report layout, 319–324 SendMail function, for delivering PDF report, 306 server-side reporting architecture of, how it works, 360–361 server-side reports in action, 367 characteristics for accessing client side, 360 integrating, 359–367 with Windows Forms client, 362–367 Service class, Windows Service application, 290 Service.asmx file, methods and WSDL information in, 230 Service.cs, after adding [WebMethod] tag, 230–231 Service1.cs adding reference to, 302–306 writing C# code inside, 302–306 ServiceBase class, Windows service application, 290 serviceInstaller1, 287–289 serviceProcessInstaller1, 287–289 SettingsComplaint.settings file, adding to Windows service project, 301 Sizing property, setting for images, 36 Smart Devices, applications by Visual Studio, 249 SOAP (Simple Object Access Protocol), for exchanging XML-based messages, 228 Solution Explorer, with personalized database, 316 Solution Explorer window, VS 2005 IDE, 447, 449 SQL Server 2005 Report Pack for Financial Reporting, web site, 361 SQL Server 2005 Reporting Services, for remote processing mode, 361 SQL Server data types, default output of common, 39 SQL Server Management Studio Express, downloading, 52 StartType property, serviceInstaller1, 288 Stock Inventory Transfer report, 116–130 building the project, 130 business case, 117 characteristics for, 116 designing layout, 120–127 property settings, 118 using subreport feature, 117 writing C# code, 127–130 StreamWriter, writing logs in text file with, 306 StringBuilder, web site for information, 340 subreport, 37–38, 117 SubReportProcessing event handler, adding, 130 s T table item adding a group to, 263–264 properties list, 264–265, 276–277 Table option, in Report Items Toolbox, 33 Table Properties dialog box, Filters tab in, 122 table report item, 336–337 TableAdapter, deleting from RealWorldDataset, 67 tabular details report pattern, 18–19 test client, web services, 233 text alignment and decoration, 43–44 text box report items, mapping data table columns to, 263, 336, 346–347 Textbox item in Report Items Toolbox, 30–31 setting font properties for, 42 Textbox Properties dialog box, 31 third-party tools, See tools Find it faster at http://superindex.apress.com/ rptSalesAnalysis.rdlc, 171 rptSaleschart.rdlc, designing layout, 319–324 rptTransferDetails.rdlc data mapping, 120 designing layout of, 120–127 specifying report to be executed, 126–127 RSConsole101, 254 RSWebParts101 web site, creating, 310–327 RSWebSite101 project building, 152–153 creating, 148–150 RSWin101 project creating Form1, 76–77 setting properties for, 77 using as a template, 83 RSWindowsService.exe, installing and checking status of, 292 Run dialog box, starting console applications from, 253 463 8547indexfinal.qxd 464 8/30/07 3:33 PM Page 464 sINDEX timer control, adding to Windows service project, 300–301 TimerDelay setting, adding to Windows service project, 301 toolbars, VS 2005 IDE, 446–447 Toolbox window, VS 2005 IDE, 447, 450 tools, using third-party with RS, 385–405 Tools menu, VS 2005 IDE, 446 travel itinerary report beautifying the report, 240–241 building the web service, 243–244 business case, 235 characteristics of, 234 creating, 234–235 creating data table for, 236–238 creating Invoke button, 247 designing report layout, 238–241 PDF report output for, 235 setting text box values, 239–240 setting up the page, 238 writing C# code for, 241–243 tree node, toggling, 432 Trial Balance report example in action, 10 Report Manager view of, 361 troubleshooting, 140–142 typed dataset, creating manually, 56–61 See also dataset s U ucase() function, 338 Universal Product Code (UPC), 387 s V VendorPO.exe, steps for scheduling, 282–283 View menu, VS 2005 IDE, 446 Visibility property, in Report Items pane, 29 Visibility tab, in Textbox Properties dialog box, 31 Visual Studio (VS) 2005 IDE, 443–454 basic structure, 445 building web services project in, 231–232 client-side reporting, 1–22 creating dataset with, 57–59 launching, 24, 443 menus, 445–446 mobile devices supported by, 249–250 Report Items supplied with, 30 structure of, 444–454 web site for information, 454 windows in, 447–454 Visual Studio 2008 Web Forms, reporting with, 431–441 Visual Studio IDE Properties window, changing report item properties in, 95–97 VS 2005 See Visual Studio (VS) 2005 IDE VS 2008 reports developing using Report Wizard, 419–429 developing using Windows Forms, 407–419 VS 2008 Windows Forms See Windows forms VS Client-Side Reporting Service, components of, 23–49 VS IDE Properties toolbox, 27 s W web controls, in ASP NET, 147 Web Forms, reporting with ASP NET, 147–226 reporting with VS 2008 ASP NET, 431–441 [WebMethod] tag, 230 web methods adding to web service, 230–231 XML message displayed after invoking, 234 Web Part 101 Report, setting properties for, 313 web part framework, contents of, 311 web parts, reporting with, 309–327 web reference, project tree after adding, 246 web services, adding web method to, 230–231 building the project, 231–232 consuming with Windows Forms client, 244–248 creating ASP NET project, 235–248 creating C# code to invoke, 247–248 creating project, 228–234 how they work, 233–234 for interoperability over any network, 227–228 test client for, 233 Web Services Description Language (WSDL) file, 228 web site ADO.NET information, 68 AJAX information, 148 ASP NET information, 148 building dynamic with ASP NET, 147–153 converting rdlc to rdl file, 360 Crystal Reports information, 369 dataset information, 55 Dundas Software, 385 generic collections information, 181 Google Translate tool, 216 HTML information, 149 installutil.exe utility, 292 Microsoft Help on web services, 228 Neodynamic, 386 NET assemblies information, 79 8547indexfinal.qxd 8/30/07 3:33 PM Page 465 sINDEX for RS to CR comparison, 371–372 menus specific to in VS2005 IDE, 446 using as a template, 83 VS 2005 IDE with RSWin101 project loaded, 77 Windows menu, VS 2005 IDE, 446 Windows Service application, reporting with, 285–307 See also New Complaints report Windows service project, 307 adding installer, 287–289 adding settings file, 301 adding timer control, 300–301 building the project, 291 creating, 286–293 installing the application, 292 steps for creating, 286–293, 295 Windows services, building, 291 reporting with, 285–307 step-by-step tutorial, 285–293 Windows Task Scheduler, running console applications from, 254 WinFormClient project adding web reference to, 245–246 building, 248 WinServerSide project C# code for ReportViewer properties, 365–367 creating, 363–364 property settings for, 364 working space, VS 2005 IDE, 453 Write() method, 255, 306 WriteLine() method, 255 WSDL file See Web Services Description Language (WSDL) file s X XML (Extensible Markup Language), web site for information, 341 XML data, reporting with, 341–349 XML project building, 349 creating data table, 344–345 designing report layout, 345–347 property settings for, 344 writing C# code for, 347–348 s Z zoom modes, in ReportViewer control, 48–49 Find it faster at http://superindex.apress.com/ NET Compact framework information at, 250 project installer information, 289 service process information, 290 SOAP information, 228 SQL Server 2005 Report Pack for Financial Reporting, 361 Visual Studio (VS) 2005 IDE information, 454 web part framework information, 311 WSDL information, 228 web site project building, 315–316 contents of framework in, 311 creating, 148–150 creating with web parts, 310 WebPartManager control, 311–313 WebPartZone, adding to web site project, 311 windows, VS 2005 IDE, 447–454 Windows application project See also Windows Forms project creating, 61–62, 331–341 Windows Explorer, starting console applications from, 254 Windows Forms, creating Windows application project with, 56–57 reporting with, 75–145 reporting with VS 2008s, 407–429 Windows Forms client accessing server-side report with, 360–361 consuming web services with, 244–248 server-side reports with, 362–367 Windows Forms project adding dataset to, 80–81 adding dataset and ReportViewer to, 85–86 adding new item to, 57 adding new, 244–245 adding ReportViewer control, 78–79, 364 assembly references added to, 79 building the project, 82 creating, 56–57, 85, 363–364 creating for Customer Address List report, 108 creating for Oracle data reporting, 351–357 creating for Stock Inventory Transfer report, 117–118 creating Form1, 76–77 creating with MS Access data, 331–341 for Product List Barcode report, 388–389 465 ... Wizard, which is new in Visual Studio 2008 for client- side RS Chapter 15: Reporting with Visual Studio 2008 Web Forms Finally, I am using this last chapter to develop reports with a Visual Studio 2008... service This is often called business-to-business (B2B) communication Client- side reporting supports both types of activities Vendors interact with businesses in different ways, according to the... SQL Server license to use RS in VS 8547CH01.qxd 7/16/07 4:18 PM Page CHAPTER s WHAT IS CLIENT- SIDE REPORTING? Server -Side Reporting Architecture This book is about client- side reporting, so why