Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 2010-09-08
2
Medium Priority
?
463 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 17

Accepted Solution

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

Expert Comment

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

Does the report show?

mlmcc
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…

604 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