Print Page | Close Window

Prompt parameters on an ASP.NET C # + IIS 7.5

Printed From: Crystal Reports Book
Category: Crystal Reports .NET 2003
Forum Name: Writing Code
Forum Discription: .NET 2003 programming API, report integration
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=17628
Printed Date: 01 May 2024 at 7:31pm


Topic: Prompt parameters on an ASP.NET C # + IIS 7.5
Posted By: jeancg
Subject: Prompt parameters on an ASP.NET C # + IIS 7.5
Date Posted: 26 Sep 2012 at 4:48am
Hi all.

I'm having a problem serious enough to consider leaving the crystal and try another solution for my reports.

I do not know what to do to solve my problem.

I have a problem when doing deploy my ASP.NET application on a windows 7 with IIS 7.5

I created my reports using the report wizard of crystal reports 2011 v.13.04 and VS 2010.

When I went to deploy my app on IIS my reports will start asking for login and password to access the database searching the net I found a solution to add a code C # on my pages, but now I am not able to use the prompt parameters of CrystalReportViewer .

I have a parameter of type date and time with a range of values ​​to specify a date and time to filter my report so that the viewer does not save crystal values ​​reported in the prompt parameters and whenever I surf report or access by a Drill-Down he again asked to enter parameter values ​​in again.

My doubt is about using prompt parameters of the crystal and configure reports via C # code how to proceed in this way.

My code:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using CrystalDecisions.CrystalReports.Engine;
using CrystalDecisions.Shared;

namespace Report.Pages.Reports
{
    public partial class ReportM1: System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            ConfiguraCrystalReports();
        }

        private void ConfiguraCrystalReports()
        {
            ReportDocument rpt = new ReportDocument();
            string reportPath = Server.MapPath("../../rpts/ReportM1.rpt");
            rpt.Load(reportPath);
            ConnectionInfo myConnectionInfo = new ConnectionInfo();
            myConnectionInfo.DatabaseName = "Database";
            myConnectionInfo.UserID = "user";
            myConnectionInfo.Password = "password";
            SetDBLogonForReport(myConnectionInfo, rpt);
            CRM1.ReportSource = rpt;
        }

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

Please help me it takes a lot

Thanks you.




Print Page | Close Window