Crystal Reports in .NET

I have just started doing some reporting in .NET.  While I do a lot of complicated development, reporting has not been one of the items that I have done a lot with.  When ever I have done reporting, it has typically been a roll your own reporting with tabular results.  I have known that I needed to do more complicated stuff, but I have just never dived into Crystal Reports.  Well, this afternoon, I finally got into Crystal Reports on a Winform.  I laid out my report, just the way I wanted it.  I kept trying to figure out how to push my datatable into a report.  Finally, I found the command .SetDataSource() which is a method on the report document object.  Here is what my code looks like:

using CrystalDecisions.CrystalReports.Engine;
using CrystalDecisions.Shared;
using System.Data;
using System.Data.SqlClient;

//Code in some method somewhere..........

DataTable dtData = .....some value returned from an object method.......;
ReportDocument rdDisplay = new ReportDocument();
rdDisplay.Load(Environment.CurrentDirectory + @"\..\..\MPReport.rpt");
rdDisplay.SetDataSource( dtData );
crvReport.ReportSource = rdDisplay;

After this, everything worked like I had expect.  I figure I will still find some more problems, but this has gotten me over the hump (and it isn't even Wednesday where I am at).

Wally

1 Comment

Comments have been disabled for this content.