Data Connectivity
 Crystal Reports Forum : Crystal Reports 9 through 2020 : Data Connectivity
Message Icon Topic: Loading report failed in ASP.NET with CR Server XI Post Reply Post New Topic
Author Message
antonmaju
Newbie
Newbie


Joined: 08 Apr 2008
Location: Indonesia
Online Status: Offline
Posts: 1
Quote antonmaju Replybullet Topic: Loading report failed in ASP.NET with CR Server XI
    Posted: 08 Apr 2008 at 7:53am
Hi, I have a problem with loading .rpt in my ASP.NET application. I'm using .Crystal Reports Server XI as my report repository. My development machine is using Windows XP SP2 and  the production server is using Windows Server 2003. My application works fine in development machine but I got "Database logon failed" message in production server. I have set database login & access rights, web.config and data source location in my .rpt to match the target machine so I don't how  this can be happened. I have tried using Windows authentication too but it didn't work

Here is my code:

// InfoStoreConnectionHelper is a custom class to handle connection with Infostore
// the report id is passed from another page
ReportApplicationServer.InfoStoreConnectionHelper helper = new ReportApplicationServer.InfoStoreConnectionHelper();
using (helper)
{
    //get client document by reportId
      CrystalDecisions.ReportAppServer.ClientDoc.ReportClientDocument doc = helper.GetClientDocumentByID(id);
    if (doc != null)
      {
           CrystalDecisions.ReportAppServer.DataDefModel.PropertyBag props = new CrystalDecisions.ReportAppServer.DataDefModel.PropertyBagClass();
           CrystalDecisions.ReportAppServer.DataDefModel.ConnectionInfos info = new CrystalDecisions.ReportAppServer.DataDefModel.ConnectionInfos();
           CrystalDecisions.ReportAppServer.DataDefModel.ConnectionInfo ci = new CrystalDecisions.ReportAppServer.DataDefModel.ConnectionInfoClass();
           props.Add("Data Source", ConfigurationManager.AppSettings["report_servername"]);
           props.Add("Initial Catalog", ConfigurationManager.AppSettings["report_dbname"]);
           ci.Attributes = props;
           ci.UserName = ConfigurationManager.AppSettings["report_username"];
           ci.Password = ConfigurationManager.AppSettings["report_password"];
           info.Add(ci);

         CrystalDecisions.ReportAppServer.DataDefModel.PropertyBag pb = new CrystalDecisions.ReportAppServer.DataDefModel.PropertyBagClass();
           CrystalDecisions.ReportAppServer.DataDefModel.PropertyBag lpb = new CrystalDecisions.ReportAppServer.DataDefModel.PropertyBagClass();
           lpb.Add("Data Source", ConfigurationManager.AppSettings["report_servername"]);
           lpb.Add("Initial Catalog", ConfigurationManager.AppSettings["report_dbname"]);
           lpb.Add("Provider", "SQLOLEDB");

           pb.Add("Database DLL", "crdb_ado.dll");
           pb.Add("QE_DatabaseType", "OLE DB (ADO)");
           pb.Add("QE_LogonProperties", lpb);
           pb.Add("QE_SQLDB", "true");

           CrystalDecisions.ReportAppServer.DataDefModel.ConnectionInfo nci = new CrystalDecisions.ReportAppServer.DataDefModel.ConnectionInfoClass();
           nci.UserName = ConfigurationManager.AppSettings["report_username"];
           nci.Password = ConfigurationManager.AppSettings["report_password"];
           nci.Kind = CrystalDecisions.ReportAppServer.DataDefModel.CrConnectionInfoKindEnum.crConnectionInfoKindCRQE;
           nci.Attributes = pb;
           foreach (CrystalDecisions.ReportAppServer.DataDefModel.Table tbl in doc.Database.Tables)
           {
                   tbl.ConnectionInfo = nci;
           }
                    
           crViewer.ReportSource = doc;
    }
}

Please help me.
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.031 seconds.