This is a migrated thread and some comments may be shown as answers.

Where to put supporting code for a report

2 Answers 71 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Chuck Harrington
Top achievements
Rank 1
Chuck Harrington asked on 07 Sep 2010, 10:14 PM
I have been trying to find the proper event to place some supporting code for a report I am developing but with no luck.  The report is already bound to a SQL datasource, but I need to load an array with some data from another table in the database. This is necessary to "look up" some rates that I need in calculating the values for some unbound text boxes in a group footer section.  I wanted to load the array using a separate connection and a datareader, however I keep getting an error when I attempt to place the report in a reportviewer in ASP.NET web form.  It will not allow me to select the report because it indicates that the connection must be open for the ExecuteReader method and will not allow me to specify the report in my Report parameter.  I do open the connection in my code and the connection string is defined in the code as well.  I currently have it in my report constructor module after the InitializeComponent() call but that doesn't work.  Any suggestions? 

2 Answers, 1 is accepted

Sort by
0
Patrick
Top achievements
Rank 1
answered on 08 Sep 2010, 01:14 PM
I don't know if this will help you, but here's what I'm doing. All my reports reside in a single class library. Contained w/in that library is a ReportUtilities class containing a slew of public static methods used for calculations in the report. Unless I'm not fully understanding what your problem is, very likely since I'm working on my 1st cup of coffee, it seems that you could implement a similiar methodology. In your ReportUtilties class, you could have a method that populates a static array containing your "look up" values. Other methods would use that static array to perform whatever calculations are needed.

HTH
0
Chuck Harrington
Top achievements
Rank 1
answered on 08 Sep 2010, 02:40 PM
I do have a separate class library for my reports.  Thanks for the idea.  I will add the Report Utilities class and move code there and make adjustment in my code for the report..  I am fairly new to Telerik reporting so I appreciate your help.
Tags
General Discussions
Asked by
Chuck Harrington
Top achievements
Rank 1
Answers by
Patrick
Top achievements
Rank 1
Chuck Harrington
Top achievements
Rank 1
Share this question
or