Solved

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

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
c# LinkButton OnClientClick 2 34
Host asp.net pages 5 25
Syntax Error 2 45
C# HTTP GET method sample code 3 40
This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
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, f…

912 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

26 Experts available now in Live!

Get 1:1 Help Now