Q: How can I extract reports from a data source for field agents to access while on the road?

Q: I have a report that’s hosted on SQL Server 2005 Reporting Services (SSRS). This report is stored locally on field agents’ laptops in a SQL Server Compact Edition database that is synchronized with the home-office database when the agents have connectivity. How can the field agents print the report while on the road?

A: Visual Studio 2008’s Microsoft ReportViewer can extract a report from any datasource (e.g., a flat file, a Microsoft Excel spreadsheet, a full-blown SQL Server database management system—DBMS); any datasource with an ODBC, OLE DB, or .NET Data Provider; or any object with an IBindingList interface. ReportViewer uses a local report processor to parse the report definition file just like SSRS, but it doesn’t handle the data fetching operations; it assumes you’ve already done that. This means you can add your SSRS Report Definition Language (RDL) report to a Visual Studio 2005 project (not Visual Studio 2008, until SQL Server 2008 ships) and reset the datasources. Then your code must open the connection, run the query, produce an ADO.NET DataTable (or any IBindingList-enabled structure), and point the LocalReport class to it. For more information, see my book “Hitchhiker’s Guide to Visual Studio and SQL Server” (hitchhikerguides.net/default.aspx).

—William Vaughn

Hide comments


  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.