Skip to Content
Former Member
Mar 17, 2009 at 05:00 PM

how to build a library to manage reports



i'd like to create a library (say a dll) which provides reports to applications wihch ask for them (rich clients and web applications).

At the moment i've developed a library which holds a class to create reportdocument objects (the reportclass associated to the rpt file which inherit from reportdocument) and initialize them with data, and holds the rpt files too. The web application page holds a crystalreportviewer (and no crystalreportsource since report files are inside the dll) , i set the viewer reportsource property to the reportdocument my class returns.

            ReportProvider provider = new ReportProvider();
            MyReportDocument x1 = provider.getMyReportDocument(); //this is an instance of ReportClass,
                                                                                //filled with data (a dataset)
            this.CrystalReportViewer1.ReportSource = x1;

there are a couple of behaviour i don't understand:

1. if i execute the above code when !isPostback, any action on the report page causes an exception (error logging on db), if i add the report to the web app and use the crystalreportsource to do the binding, the postback condition doesn't harm the report.

2. if i remove the postback check (rebind the viewer every page load) and use my class, the report doesn't behave correctly, for example i can move to page 2 but not advance further; if i press last page it goes to last page but when if i press preavious page it goes to first page , not last-1

Since i'm a beginner i'm pretty sure i'm doing something wrong, could anyone give me any hints about how to implement the library , i mean a tutorial if exist, or which classes to use, what to return to viewer