Friday, December 10, 2004

Crystal Reports in VB .NET

Here I go again. It's time to integrate a Crystal Report into VB.NET. My current goal is simple. I need to query my database and create a report. I have Crystal Reports v10 installed and working. The first link I found on doing this is at http://www.vbcity.com/forums/faq.asp?fid=15&cat=Crystal+Reports. I am trying to create a Crystal Report control in a Windows forms interface.

1. Created the XSD by adding a new item to the project - Dataset
2. Add a new item to your project - Crystal Report
3. Using the Wizard, design the report - Use the XSD as the data source
4. Create a form with a Crystal Report Viewer on it
5. Create a dataset object with only tables contained in the XSD
6. Use this code to link the dataset, report and ReportViewer
[code lang='vb']
Dim rpt As New resultsReport2
rpt.SetDataSource(resultsDataset)
CrystalReportViewer1.ReportSource = rpt

[/code]
These are the basics. Unfortunately, I have a massive dataset and I keep getting out of memory errors. If I only select 500 rows, the report works but it takes forever to load.

UPDATE: I gave up and bought a book (300+ pages). Apparently this subject is much more complex than just learning a few tips form a web page. I headed down to SoftPro and picked up Professional Crystal Reports for Visual Studio .NET by David McAmis ISBN 0-7645-5730-0, This is another Wrox book which I usually don't like but Amazon readers seemed to rate it highly enough and there isn't an alternative Microsoft Press book so it's reading time. Since I was already there and need a better grasp on resusable code, I picked up OOP: Building Reusable Components with Microsoft Visual Basic .NET ISBN 0-7356-1379-6. I am looking forward to reading this one. It's another Microsoft Press so I know they are standardized on the coding conventions.

No comments:

Post a Comment