Solved

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

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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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.
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.
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

717 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