Solved

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

Posted on 2010-09-08
2
443 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

760 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

20 Experts available now in Live!

Get 1:1 Help Now