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

Learn how to use Visual Studio’s Microsoft ReportViewer to extract reports.

William Vaughn

August 27, 2008

1 Min Read
ITPro Today logo in a gray background | ITPro Today

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

Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like