[ Download Sample ]
Those of you familiar with Crystal are probably asking, what exactly I’m smoking? You can’t create Crystal Reports on the fly, at least not with Crystal .NET. So I’ll admit this title is a little misleading. But I will show you how to dynamically create new looking reports by using an existing report. I consider that close to creating reports on the fly.
I’ve seen many .NET developers asking how to add fields to existing reports or how to altogether create a Crystal report on the fly, in code. The answer for those using Crystal .NET is that it can’t be done. However, using Crystal 10, I’m going to show you how to come close to dynamically creating your report.
This code was created using Visual Studio 2003 Enterprise Architect, Crystal Reports 10 Developer Edition, and SQL Server 2000 on a Windows XP SP2 machine. I also have the Northwind sample database installed on my SQL Server and I utilize the 1.x version of the Microsoft Data Access Application Blocks in some of the C# code. I’m also assuming that the reader has experience developing with ASP.NET, C#, Crystal Reports, and SQL.