cancel
Showing results for 
Search instead for 
Did you mean: 

Report tries to connect to wrong database

Former Member
0 Kudos

Hello,

We're currently developing an ASP.NET C# Web Application and integrate some Crystal Reports using the CrystalReportViewer control. Our environment looks like this:

<h1>Dev Environment:</h1>

One machine using

- Windows Server 2003

- .NET Framework 3.5 SP1

- IIS 6

- SQL Server 2008 Developer Edition, Default instance

- Crystal Reports 2008 (no service packs applied so far)

<h1>Production Environment:</h1>

One machine using

- Windows Server 2008

- .NET Framework 3.5 SP1

- IIS 7

- SQL Server 2008 Express Edition, Named instance

I've designed the report on the Dev Environment. For this I created a new database connection inside the report to the Dev Database. We use OLE DB for SQL Server to connect to the database using sql authentication. We pass the login credentials in code. The report uses two sql server views and one sql table to display its data. The report is configured to not store data inside.

To pass the login credentials, we use the same code as recommended in your code samples on https://www.sdn.sap.com/irj/boc/samples:


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

namespace Ispin.Irma.Helpman
{
    public partial class ShowReport : System.Web.UI.Page
    {
        protected void Page_Init(object sender, EventArgs e)
        {
            ConfigureCrystalReports();
        }

        private void ConfigureCrystalReports()
        {
            string ReportPath = Server.MapPath("ReportCallTimeUsage.rpt");    

            ConnectionInfo connectionInfo = new ConnectionInfo();

            connectionInfo.ServerName = "ANANKE\\SQLEXPRESS";
            connectionInfo.DatabaseName = "Irma";
            connectionInfo.UserID = "<username goes here>";
            connectionInfo.Password = "<password goes here>";
            CrystalReportViewer1.ReportSource = ReportPath;
            SetDBLogonForReport(connectionInfo);
        }

        private void SetDBLogonForReport(ConnectionInfo connectionInfo)
        {
            TableLogOnInfos tableLogOnInfos = CrystalReportViewer1.LogOnInfo;
            foreach (TableLogOnInfo tableLogOnInfo in tableLogOnInfos)
            {
                tableLogOnInfo.ConnectionInfo = connectionInfo;
            }
        }
    }
}

<h1>Problem:</h1>

When deploying the application and reports to the production environemt, the reports come up with a login window, forcing me to enter login credentials to the dev database. At this point I can only change the username and passwort fields, but not the server or the database. So, I'm unable to enter the correct login data to connect to the production system since this is on another machine.

<h1>What I already did:</h1>

- Install Crystal Reports 2008 runtime on production webserver (this helped, but the login problem still arises). I got the runtime from https://websmp230.sap-ag.de/sap(bD1kZSZjPTAwMQ==)/bc/bsp/spn/bobj_download/main.htm, I've choosen the "Crystal Reports 2008 - Redistributable Installation" file, published on 10.09.2008.

- Install Crystal Reports 2008 Trial Edition on production server (I could start the report sucessfully out of the designer using the login credentials for the productive database server).

It seems that the code for passing the credentials at runtime is not effective. It looks as if the report is saving login credentials inside the rpt file. but why? It must be possible to pass login credentials by code. Can you please provide me additional hints for getting this thing to work?

Thank you very much.

Edited by: AndreG on Aug 9, 2009 3:41 PM

Code formatting seems not to work.... sorry.

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

Lots of posting for this same question. Please search before posting the same question again.

Answers (0)