How to Programmatically Load a Report

You won't normally load reports from the My Documents\ Visual Studio Projects folder on an end user's computer, and the login information and database location are normally different when you deploy a report. For this reason, you must be able to load a report dynamically and set login information at runtime.

Using the TableLogOnInfo class of the CrystalDecisions.Shared namespace, you have programmatic access to the login information for the database tables in a report. Using the ReportDocument class, you can specify a report to load at runtime.

In your applications, you should have a single form named rptViewer that has the report viewer control. The report name that the user is requesting is passed in the ...

Get Sams Teach Yourself Visual Studio® .NET 2003 in 21 Days now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.