Writing Code
 Crystal Reports Forum : Crystal Reports .NET 2003 : Writing Code
Message Icon Topic: Prompt parameters on an ASP.NET C # + IIS 7.5 Post Reply Post New Topic
Author Message
jeancg
Newbie
Newbie
Avatar

Joined: 20 Aug 2012
Online Status: Offline
Posts: 2
Quote jeancg Replybullet Topic: Prompt parameters on an ASP.NET C # + IIS 7.5
    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.

IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.047 seconds.