Designing Crystal reports – from a database vs. from ADO.NET

One of the advances of Crystal in version 8 was that we had the ability to create TTX files from our recordsets and then use the TTX files to design reports from. This alleviated a huge headache of being forced to either use that mistake of a database environment or hooking directly to databases to create reports. Building these dependencies between the report and one of those resources meant confusing memory problems when you ran the report. The TTX file was just a little text file that contained the schema of your recordset. Once the report was designed, you didn’t even need to tote the ttx file around anymore.

In .NET, this evolved to the ability for the report to be designed from an dataset. You do this by creating a dataset object in your project and linking to that when you design the report. I generally create the object by doing a dataset.writexmlschema in my code initially. Once that file is created, I comment out the line and bring the schema into my project and generate a dataset object from it. (Did you know you can do that in vs2003 by right clicking on the xsd and selecting the mysterious “run custom tool”?)

Many people are still unaware of this feature and do what comes naturally, which is to point directly to the database for desiging a report. This is one of the causes of the dreadful “please logon” message we get at runtime when trying to view a report. (Another one, I discovered was passing a dataview to the report’s datasource instead of a datatable and apparently passing a dataset can do this too.)

Here is a PDF from the Crystal Reports .NET DevCenter on the Business Objects site that explains how to build reports from ADO.NET.

Also, here is an article by Susan Harkins that I found for someone that explains how to create an XSD file from Access.

Posted from BLInk!

  Sign up for my newsletter so you don't miss my conference & Pluralsight course announcements!  

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.