Solved

crystal reports- asp.net- load more than one report into the viewer

Posted on 2010-09-08
2
451 Views
Last Modified: 2012-05-10
i have the below code that dynamically loads a .rpt file. the report is pulling from my proj management application and i want it to show multiple projects based on input from the user...

on the webform UI i have controls that will allow me to eitehr get a list of project id values or i can generate a dataset or stored proc to get the desired project id values... lets say projectID = 1 and projectID = 2.

so i want the report to take these projectID values and show the report for both using the next, first, last buttons to flip though each report in the resulting dataset (or how ever i pass the project id values to crystal)
ReportDocument rpt = new ReportDocument();
        rpt.Load(Server.MapPath(strReportPath));
        crvReport.ReportSource = rpt; 


        // Project Id Filter
        ParameterValues myvals = new ParameterValues();
        ParameterDiscreteValue myDiscrete = new ParameterDiscreteValue();
        myDiscrete.Value = strSelectedProjects.ToString();
        myvals.Add(myDiscrete); // this is "1,2,3"
        rpt.DataDefinition.ParameterFields["ProjectId"].ApplyCurrentValues(myvals);


ConnectionInfo connectionInfo = new ConnectionInfo();
        connectionInfo.DatabaseName = Global.GetDatabaseName();
        connectionInfo.UserID = Global.GetUserID();
        connectionInfo.Password = Global.GetPassword();
        SetDBLogonForReport(connectionInfo, rpt);



private void SetDBLogonForReport(ConnectionInfo connectionInfo, ReportDocument reportDocument)
    {
        Tables tables = reportDocument.Database.Tables;
        foreach (CrystalDecisions.CrystalReports.Engine.Table table in tables)
        {
            TableLogOnInfo tableLogonInfo = table.LogOnInfo;
            tableLogonInfo.ConnectionInfo = connectionInfo;
            table.ApplyLogOnInfo(tableLogonInfo);
        }
    }

Open in new window

0
Comment
Question by:realcoding
2 Comments
 
LVL 17

Accepted Solution

by:
MIKE earned 500 total points
ID: 33631348
Sounds like you'll need the .NET guys to me....
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 33650541
What issue are you having?

Does the report show?

mlmcc
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

815 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now