Database logon failed when opening report with parameter values in CrystalReportViewer

Hi,
I designed 2 crystal reports: report A contains parameter fields and report B did not contain any parameter
I can open both reports in development site using CrystalReportViewer control. When I open the reports in testing site,
I can open report B but can't open report A. It display error message "Database logon failed". When I set EnableDatabaseLogonPrompt
to true and try to open the report A again, it shows database connection data which was created on report.
In addition, it is strange that it displays error "Database logon failed" when I click an item in group tree panel of the report B. This indicates that it can load data from database
in testing site but it connect to development database when clicking items in group tree panel
All reports connect to database using Windows Authenication. It use dynamic database connection at runtime
How to ensure the report always connect database using login data dynamically at runtime?
Below is my code about database connection:
string strServerName = null;
string strDatabaseName = null;
ReportDocument rptDoc = new ReportDocument();
rptDoc.Load(strFilePath);
ConnectionInfo connInfo = new ConnectionInfo();
TableLogOnInfo logonInfo;
for (int i = 0; i < rptDoc.Database.Tables.Count; i++)
logonInfo = rptDoc.Database.Tables[i].LogOnInfo;
ReportHelper.GetReportConnection(ref strServerName, ref strDatabaseName, strSystemType);
logonInfo.ConnectionInfo.ServerName = strServerName; 
logonInfo.ConnectionInfo.DatabaseName = strDatabaseName;
logonInfo.ConnectionInfo.IntegratedSecurity = true;
rptDoc.Database.Tables[i].ApplyLogOnInfo(logonInfo);
rptDoc.Database.Tables[i].Location = rptDoc.Database.Tables[i].Location.Substring(0, rptDoc.Database.Tables[i].Location.Length - 2);
crvViewer.ReportSource = rptDoc;
crvViewer.DataBind();
Development environment:
- SAP Crystal Reports 2013 Support Pack 1
- Visual Studio Professional 2012
- .NET Framework 3.5
- DDL
CrystalDecisions.Shared (v 13.0.8.1216)
CrystalDecisions.Web (v 13.0.8.1216)
CrystalDecisions.CrystalReports.Engine (v 13.0.8.1216)
Database connection in crystal report:
- Database Type: OLEDB (ADO)
- Provider: SQLOLEDB
- Integrated Security: True
Thanks and Regards,
Tony

Hi Tonylck
Try  to pass login info to crystal report dynamically as follows:
using System;
using System.Windows.Forms;
using CrystalDecisions.CrystalReports.Engine;
using CrystalDecisions.Shared;
namespace WindowsApplication1
public partial class Form1 : Form
public Form1()
InitializeComponent();
private void button1_Click(object sender, EventArgs e)
ReportDocument cryRpt = new ReportDocument();
TableLogOnInfos crtableLogoninfos = new TableLogOnInfos();
TableLogOnInfo crtableLogoninfo = new TableLogOnInfo();
ConnectionInfo crConnectionInfo = new ConnectionInfo();
Tables CrTables ;
cryRpt.Load("PUT CRYSTAL REPORT PATH HERE\CrystalReport1.rpt");
crConnectionInfo.ServerName = "YOUR SERVER NAME";
crConnectionInfo.DatabaseName = "YOUR DATABASE NAME";
crConnectionInfo.UserID = "YOUR DATABASE USERNAME";
crConnectionInfo.Password = "YOUR DATABASE PASSWORD";
CrTables = cryRpt.Database.Tables ;
foreach (CrystalDecisions.CrystalReports.Engine.Table CrTable in CrTables)
crtableLogoninfo = CrTable.LogOnInfo;
crtableLogoninfo.ConnectionInfo = crConnectionInfo;
CrTable.ApplyLogOnInfo(crtableLogoninfo);
crystalReportViewer1.ReportSource = cryRpt;
crystalReportViewer1.Refresh();
Ref
http://csharp.net-informations.com/crystal-reports/csharp-crystal-reports-dynamic-login.htm
Mark as answer if you find it useful
Shridhar J Joshi Thanks a lot

Similar Messages

  • Database Logon Failed after first report

    I have a Windows Server 2003 x86 server running IIS6 and ASP.NET. On this server, I have two different web forms set up to export Crystal Reports to PDF.
    My problem is that only one of these reports can run. For example, I open report 1 and can then reopen (generate PDF of) report1 as many times as I want. I cannot open report 2 - I get a "Database Logon Failed" error message. If I restart the server, I can generate a PDF of report 2 successfully and as many times as I want but report 1 will get a "Database Logon Failed" error message.
    Has anyone seen this behavior before? My code is very concise and manually closes the report document (and forces the garbage collection to run) once the PDF has been generated. However, for some reason, the report is staying in memory and is trying to run again even though it has been closed. It is driving me crazy.
    Thanks in advance for any assistance you can offer.

    Let's get the server confusion out of the way.
    A "server" runtime install is an msi file called CrystalReports11_5_NET_2005.msi.
    The msi is in a download called Crystal Reports XI Release 2 - FP x.x .NET Server Install (where x.x refers to SP or FP version (e.g.; Crystal Reports XI Release 2 - FP 5.6 .NET Server Install)
    So, this gives you an easy way of installing the CR runtime on a server (e.g.. Win 2003 server). No CR server (RAS) implication here. To install the runtime, all you have to do is run the msi, provide the keycode when prompted and the runtime is installed. You should see the directory C:\Program Files\Business Objects\Common\3.5\bin created. No pretty interface, etc. If you want a pretty interface, you create your own setup project or msi using the CR msm files.
    Hopefully this clears up the "server" confusion.
    To the actual issue on hand.
    You say this works with older "Crystal Reports viewers" installed on a WIN 2003 64 bit server. My question is; does this CR XI r2 based app work anywhere? Your dev box? Staging server?
    Ludek

  • Database Logon Failed when loading Access mdb that use a system mdw

    I am trying to get my Report Viewer ASP.NET application running 11 R2 SP3 to open a report that uses Access database with a system database file (mdb and mdw file)
    the report runs fine in the designer and it runs fine on the developer test computer
    but the production environment that does not have the full Crystal Designer installed just the runtime engine (but does have the full MSAccess running) cannot load the database
    i keep getting "Database Logon Failed"
    SWIP Reports
    Error Exporting Report
    Report:     Help Desk Reports Over 3 Days
    Server Name:     \\poseidon\IT\Databases\itdept.mdb
    Database Name:     \\poseidon\IT\Databases\itdept.mdb
    User:     GLOBAL\ADMINISTRATOR
    IP:     127.0.0.1
    ============================================================
    | Exception Information
    +----------------------------------------------------------------------
    |  Exception Message:     Database logon failed.
    |  Exception Source:     CrystalDecisions.ReportAppServer.DataSetConversion
    |  Inner Exception:          
    |  Begin Stack Trace:
    |        at CrystalDecisions.ReportAppServer.ConvertDotNetToErom.T_
    |          hrowDotNetException(Exception e)
    |        at CrystalDecisions.ReportSource.EromReportSourceBase.Exp_
    |          ortToStream(ExportRequestContext reqContext)
    |        at CrystalDecisions.CrystalReports.Engine.FormatEngine.Ex_
    |          portToStream(ExportRequestContext reqContext)
    |        at CrystalDecisions.CrystalReports.Engine.ReportDocument._
    |          ExportToStream(ExportOptions options)
    |        at CrystalDecisions.CrystalReports.Engine.ReportDocument._
    |          ExportToHttpResponse(ExportOptions options, HttpRe_
    |          sponse response, Boolean asAttachment, String atta_
    |          chmentName)
    |        at CrystalDecisions.CrystalReports.Engine.ReportDocument._
    |          ExportToHttpResponse(ExportFormatType formatType,_
    |          HttpResponse response, Boolean asAttachment, Strin_
    |          g attachmentName)
    |        at reports.PushReport(ExportFormatType expType, String Co_
    |          ntentType, String Ext, Boolean Popup)
    |        at reports.exportReport(String strExpFmt)
    +----------------------------------------------------------------------
    For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.
    does anyone have any advice on why this is failing only on the server but is not failing on the developer or the designer computers.

    public Reports(String RptPath)
                this._ExpOptions.ExportDestinationType = ExportDestinationType.NoDestination;
                this._ExpOptions.ExportFormatType = ExportFormatType.NoFormat;
                this._RptDoc = new ReportDocument();
                this._RptDoc.Load(RptPath, OpenReportMethod.OpenReportByTempCopy);
                login();
    private void login()
                if (!_IsLoggedIn)
                    try
                        String dbName = this._RptDoc.DataSourceConnections[0].ServerName.ToString();
                        for (int i = 0; i < this._RptDoc.DataSourceConnections.Count; i++)
                            this._RptDoc.DataSourceConnections<i>.SetLogon(uid(dbName), pwd(dbName));
                        foreach (ReportDocument Sub in this._RptDoc.Subreports)
                            dbName = Sub.DataSourceConnections[0].ServerName.ToString();
                            for (int i = 0; i < Sub.DataSourceConnections.Count; i++)
                                Sub.DataSourceConnections<i>.SetLogon(uid(dbName), pwd(dbName));
                        ConnectionInfo coninfo = new ConnectionInfo();
                        coninfo.DatabaseName = this._RptDoc.DataSourceConnections[0].DatabaseName;
                        coninfo.ServerName = this._RptDoc.DataSourceConnections[0].ServerName;
                        coninfo.UserID = this._RptDoc.DataSourceConnections[0].UserID;
                        coninfo.Password = this._RptDoc.DataSourceConnections[0].Password;
                        foreach (CrystalDecisions.CrystalReports.Engine.Table crtbl in this._RptDoc.Database.Tables)
                            TableLogOnInfo logoninfo = crtbl.LogOnInfo;
                            logoninfo.ConnectionInfo = coninfo;
                            crtbl.ApplyLogOnInfo(logoninfo);
                        _IsLoggedIn = true;

  • Database logon failed when deploy CR on Windows Server 2008

    I use Crystal Reports for Visual Studio 2010 Production Release with MVC 2 web aplication and SQL Server 2008 database server. When I compile/run from VS 2010 it running well, but when deploy it on Windows Server 2008, when load certain report (Not All report) face the following exception message:
    Database logon failed
    Stack Trace is as the following:
    at CrystalDecisions.ReportAppServer.ConvertDotNetToErom.ThrowDotNetException(Exception e) at CrystalDecisions.ReportSource.EromReportSourceBase.ExportToStream(ExportRequestContext reqContext) at CrystalDecisions.CrystalReports.Engine.FormatEngine.ExportToStream(ExportRequestContext reqContext) at CrystalDecisions.CrystalReports.Engine.ReportDocument.ExportToStream(ExportOptions options) at CrystalDecisions.CrystalReports.Engine.ReportDocument.ExportToStream(ExportFormatType formatType) at SequisLife.Controllers.ReportController.run_report(String report_name, IDictionary`2 dic_param)
    InnerException:
    System.Runtime.InteropServices.COMException (0x8004100F): Database logon failed. at CrystalDecisions.ReportAppServer.Controllers.ReportSourceClass.Export(ExportOptions pExportOptions, RequestContext pRequestContext) at CrystalDecisions.ReportSource.EromReportSourceBase.ExportToStream(ExportRequestContext reqContext)
    run_report method is as the following:
    private ActionResult run_report(string report_name, IDictionary<string, string> dic_param)
                string ls_respon = "";
                try
                    get_sqllogin();
                    ReportClass rptH = new ReportClass();               
                    rptH.FileName = Server.MapPath(VirtualPathUtility.ToAbsolute(report_name));
                    rptH.Load();             
                    rptH.Refresh();
                    Database crDataBase;
                    Tables crTables;
                    TableLogOnInfo crTableLogOnInfo;
                    ConnectionInfo reportConnectionInfo = new ConnectionInfo();
                    reportConnectionInfo.ServerName = server;
                    reportConnectionInfo.DatabaseName = database;
                    reportConnectionInfo.UserID = login_user;
                    reportConnectionInfo.Password = login_pass;
                    crDataBase = rptH.Database;
                    crTables = crDataBase.Tables;
                    foreach (Table crTable in crTables)
                        crTableLogOnInfo = crTable.LogOnInfo;
                        crTableLogOnInfo.ConnectionInfo = reportConnectionInfo;
                        crTable.ApplyLogOnInfo(crTableLogOnInfo);                  
                    ParameterFields lpf_parameters = rptH.ParameterFields;
                    if (lpf_parameters.Count > 0)
                        foreach (ParameterField lpf_param in lpf_parameters)
                            var llst_tmps = dic_param.Where(d => d.Key == lpf_param.Name);
                            foreach (var param in llst_tmps)
                                if (param.Key == lpf_param.Name)
                                    if (lpf_param.ReportName == "")
                                        rptH.SetParameterValue(lpf_param.Name, param.Value);
                                    else
                                        rptH.SetParameterValue(lpf_param.Name, param.Value, lpf_param.ReportName);
                    Stream stream = rptH.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);
                    return File(stream, "application/pdf");
                catch (Exception ex)
                    ls_respon += ex.Message;
                    ls_respon = " - "ex.StackTrace;
                    ls_respon += " - " + ex.InnerException;
                    ls_respon += " - " + ex.Source;
                    ls_respon += " - " + ex.Data;
                    return Content(ls_respon);
    Please any body hepl me...
    Thank's in advance

    Hi,
    I am using CR with visual studio 2010 in windows 7 box 64bit box. using a ADO.net data source. And I need to export .rpt as pdf.The solution works fine in my dev box. by when i try to deploy in a windows server 2008 R2 box (64bit) it fails . Both my dev box and deplyment box uses sql server 2008 DB . Also i am using .Net framework 4.0 (not client profile)
    installed the following things in deployment box:
    1. CRRuntime_64bit_13_0_1.msi in
    2. Also copied the CRforVS_mergemodules_13_0_1 in C:\Program Files (x86)\Common Files\Merge Modules
    I get the following error in my Box:
    CrystalDecisions.ReportAppServer.ConvertDotNetToErom.ThrowDotNetException(Exception e)   at CrystalDecisions.ReportSource.EromReportSourceBase.ExportToStream(ExportRequestContext reqContext)   at CrystalDecisions.CrystalReports.Engine.FormatEngine.ExportToStream(ExportRequestContext reqContext)   at CrystalDecisions.CrystalReports.Engine.FormatEngine.Export(ExportRequestContext reqContext)   at CrystalDecisions.CrystalReports.Engine.ReportDocument.ExportToDisk(ExportFormatType formatType, String fileName)   at Tesco.Instore.PickingControl.ReportController.PrintDriverDocumentation(String driverDocumentation, Int32 vehicleTripId)] 20/10/2011 08:08:41        PCS        Critical                   Classic .NET AppPool      Error running End of Van [Logon failed.
    Error in File temp_31b3196f-fd25-45c8-b657-5d9cd7c9dccb {4F74290C-D56E-4FC4-8DEF-371BB5C5B10B}.rpt:
    Unable to connect: incorrect log on parameters.]
    I also verified the database connection is upto date. while creating the solution
    the project build is set to anyCPU.
    is there anything else i have to install ?? Please help me ..I am trying this thing from last one week and have not got any proper solution till now

  • Crystal 2008 Hangs When Opening Report With Geographic Map

    Greetings - CR just hangs when I open a report that has an existing geographic map or if I create a new report with a geographic map.  I've uninstalled and reinstalled, and made sure the updates were applied.  Searched the forums but haven't found anything to help.
    Any suggestions?
    Thank you.

    Hi Doug,
    Usual next steps, What OS are you using and did you install CR with local Administrator rights?
    Are you on a domain where your IT department have modified your profile, you may be in the Admin group but they can alter the default settings. Check to confirm.
    Try Service Pack 2 from the download page, although I have not heard of anyone else having this specific problem.
    Check the System and application Event logs to see if anything failed, permissions, access etc.
    Is there anyone else in your company having the same problem? You could try downloading Process Monitor from www.sysinternals.com and filter on crw32.exe and watch when you try to access the maps.
    Thank you
    Don

  • Load Report failed when opening Report under IIS 5.1

    I recently upgraded to Crystal Reports 2008 (12) from Crystal Reports Basic 2008 (10.5).  I am using Visual Studio 2008 with the CrystalReportViewer.  Now when I run my reports from the website under IIS 5.1 (Windows XP SP3), I get a Load Report Failed.  The detailed exception follow:
    Error loading report (ConfigureCrystalReports)
    CrystalDecisions.Shared.CrystalReportsException: Load report failed. ---> System.Runtime.InteropServices.COMException (0x800001F5): The Report Application Server failed at CrystalDecisions.ReportAppServer.ClientDoc.ReportClientDocumentClass.Open(Object& DocumentPath, Int32 Options) at CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.Open(Object& DocumentPath, Int32 Options) at CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.EnsureDocumentIsOpened() --- End of inner exception stack trace --- at CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.EnsureDocumentIsOpened() at CrystalDecisions.CrystalReports.Engine.ReportDocument.Load(String filename, OpenReportMethod openMethod, Int16 parentJob) at CrystalDecisions.CrystalReports.Engine.ReportDocument.Load(String filename) at ncspo.ReportViewer.ConfigureCrystalReports() in D:\Websites\NCSPO\FIS\ReportViewer.aspx.vb:line 43
    If I run the report using the ASP.Net Development Server, the reports run fine.  It only fails under IIS.  From other posts, I understand that i need to grant the Network Service and IIS_WPG group read/write permissions to the windows\temp folder.  I have done this for the Network Service, but the IIS_WPG group was not introduced until IIS 6.0.  Any ideas on how I can get this working under IIS 5.1?
    Here is the code behind page:
    Private Sub ConfigureCrystalReports()
                Try
                    rpt = New ReportDocument
                    Dim strReportFilename As String
                    If Len(Request.QueryString("ReportFilename")) > 0 Then
                        strReportFilename = Request.QueryString("ReportFilename")
                    Else
                        strReportFilename = System.Configuration.ConfigurationManager.AppSettings("cr404Page")
                    End If
                    Dim strReportPath As String = System.Configuration.ConfigurationManager.AppSettings("ReportPath")
                    Dim strReportFilePath As String = strReportPath & strReportFilename
                    Dim strReportFilePath_Full As String = Server.MapPath(strReportFilePath)
                    rpt.Load(strReportFilePath_Full)    <--- Exception occurs on this line
                Catch ex As Exception
                    lblStatus.Text = "Error loading report (ConfigureCrystalReports)"
                    lblStatus.Text &= "<BR>" & ex.ToString()
                    ncspo.clsMisc.LogError(ex, Me)
                End Try
            End Sub

    Am I correct in reading the following 2 documents that IIS 5.1 is not supported?
    If you check this document.  It shows IIS6 and 7 no support on 5.  See page 6
    [https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/f05523e4-35c4-2b10-2c89-9fcf64b0dd22]
    This document also on page 5
    [https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/50a87366-da1d-2b10-e1b4-a37ab37a2dea]
    Thanks.

  • Error message: Table could not be found when opening reports with InfoView or CMC

    Post Author: Giovanni
    CA Forum: Authentication
    Hi All,
    I have Crystal Reports Server XI R2 installed on a server and the database folder (foxpro) is located on a different server. Crystal is connected to the database using an ODBC connection (UNC path).
    When I try to preview a report in Infoview or CMC I get the following error: "There was an error retrieving data from the server: The table 'dp' could not be found. Error in File C:\WINDOWS\TEMP\{BC665D6D-95DE-426B-A7A2-EBF9D23F42F4}.rpt: The table could not be found."
    dp is the name of one of our tables.
    If I publish a report that uses sql database or a foxpro db that is located on the same server as Crystal Server I donu2019t receive any error message..
    Please help if you can and thanks in advance.
    Giovanni

    Post Author: colin mackenzie
    CA Forum: Authentication
    Hi Giovanni.
    This post of yours is going on 2 weeks old.
    Have you solved your problem?

  • Database Logon Failed in Drill Down reports

    I am developing reports on Crystal Reports XI R2, VS.NET 2005 , SQL Server 2000, C#.
    I am getting Database Logon Failed when I click on a drill down link in the report. It works if I click on the drill down link with in a minute. But if I wait for a minute and click on drill down, I am getting Database Logon Failed 
    Error in Crystal report viewer14
    Object reference not set to an instance of an object
    Any help would be greatly appreciated.
    Thanks,
    Sailu

    The above code should be written after the loading of report.
    For example-
    private void Page_Load(object sender, System.EventArgs e)
                   // Put user code to initialize the page here
                   if (!IsPostBack)
                        crReport.Load(Server.MapPath("CrystalReport1.rpt"));
                        ConnectionInfo crConn= new ConnectionInfo();
                        crConn.ServerName="D-3271-SQL";
                        crConn.DatabaseName="Northwind";
                        crConn.UserID="sa";
                        crConn.Password="sa";
                        Tables crTables=crReport.Database.Tables;
                        foreach(CrystalDecisions.CrystalReports.Engine.Table crTable in crTables)
                             TableLogOnInfo crLogoninfo=crTable.LogOnInfo;
                             crLogoninfo.ConnectionInfo =crConn;
                             crTable.ApplyLogOnInfo(crLogoninfo);
                   CrystalReportViewer1.ReportSource =crReport;
    I hope this help
    Regards
    Amit
    Edited by: Amit Singh on Aug 21, 2008 4:48 PM

  • Database Logon Failed which created by Crystal Report 2008

    this time i meet the famous error again which is database logon failed.
    i created a crystal report 2008 starting from blank report, then connect with odbc
    i use 2008 method
    objRpt.SetDatabaseLogon(db_username, db_password, odbc_name, database_name);
    2008 method will get database logon failed even set database location and verify database again
    then i use 8.5 method and try again for 2008 report. it said field name is unknown for one of formula
    then i drag field again for formula and set database location and verify database again
    it said the same error.
    then i uninstall 8.5 crytal report software in window 7 deployment machine, and do above again, it said the same error
    //'Create a new Stored Procedure Table to replace the reports current table.
            CrystalDecisions.ReportAppServer.DataDefModel.Procedure boTable = new CrystalDecisions.ReportAppServer.DataDefModel.Procedure();
            //'boMainPropertyBag: These hold the attributes of the tables ConnectionInfo object
            PropertyBag boMainPropertyBag = new PropertyBag();
            //'boInnerPropertyBag: These hold the attributes for the QE_LogonProperties
            //'In the main property bag (boMainPropertyBag)
            PropertyBag boInnerPropertyBag = new PropertyBag();
            //'Set the attributes for the boInnerPropertyBag
            boInnerPropertyBag.Add("Connect Timeout", "15");
            //boInnerPropertyBag.Add("Data Source", "MyDataSource");
            boInnerPropertyBag.Add("Data Source", "10.1.1.191");
            boInnerPropertyBag.Add("DataTypeCompatibility", "0");
            boInnerPropertyBag.Add("General Timeout", "0");
            //boInnerPropertyBag.Add("Initial Catalog", "MyCatalog");
            boInnerPropertyBag.Add("Initial Catalog", database_name);
            boInnerPropertyBag.Add("Integrated Security", "False");
            boInnerPropertyBag.Add("Locale Identifier", "1033");
            boInnerPropertyBag.Add("MARS Connection", "0");
            //boInnerPropertyBag.Add("OLE DB Services", "-5");
            //boInnerPropertyBag.Add("ODBC", "-5");
            boInnerPropertyBag.Add("ODBC", "Cheque");
            boInnerPropertyBag.Add("Provider", "SQLNCLI");
            boInnerPropertyBag.Add("Tag with column collation when possible", "0");
            boInnerPropertyBag.Add("Trust Server Certificate", "0");
            boInnerPropertyBag.Add("Use Encryption for Data", "0");
            //'Set the attributes for the boMainPropertyBag
            boMainPropertyBag.Add("Database DLL", "crdb_ado.dll");
            //boMainPropertyBag.Add("Database DLL", "p2sodbc.dll");
            //boMainPropertyBag.Add("QE_DatabaseName", "VEPILOT");
            boMainPropertyBag.Add("QE_DatabaseName", database_name);
            //boMainPropertyBag.Add("QE_DatabaseType", "OLE DB (ADO)");
            boMainPropertyBag.Add("QE_DatabaseType", "ODBC");
            //'Add the QE_LogonProperties we set in the boInnerPropertyBag Object
            boMainPropertyBag.Add("QE_LogonProperties", boInnerPropertyBag);
            boMainPropertyBag.Add("QE_ServerDescription", "MyServer");
            boMainPropertyBag.Add("QE_SQLDB", "True");
            boMainPropertyBag.Add("SSO Enabled", "False");
            //'Create a new ConnectionInfo object
            CrystalDecisions.ReportAppServer.DataDefModel.ConnectionInfo boConnectionInfo = new CrystalDecisions.ReportAppServer.DataDefModel.ConnectionInfo();
            //'Pass the database properties to a connection info object
            boConnectionInfo.Attributes = boMainPropertyBag;
            //'Set the connection kind
            boConnectionInfo.Kind = CrConnectionInfoKindEnum.crConnectionInfoKindCRQE;
            //'*EDIT* Set the User Name and Password if required.
            boConnectionInfo.UserName = db_username;
            boConnectionInfo.Password = db_password;
            //'Pass the connection information to the table
            boTable.ConnectionInfo = boConnectionInfo;
    CrystalDecisions.ReportAppServer.DataDefModel.Tables boTables = objRpt.ReportClientDocument.DatabaseController.Database.Tables;
                CrystalDecisions.CrystalReports.Engine.Tables tables = objRpt.Database.Tables;
                foreach (CrystalDecisions.CrystalReports.Engine.Table table in tables)
                    if (!string.IsNullOrEmpty(table.Name))
                        //boTable.Name = table.Name;
                        //boTable.QualifiedName = database_name + ".dbo." + table.Name;
                        //boTable.Alias = table.Name;
                        boTable.Name = "sp_ChequeIssueDetRpt";
                        boTable.QualifiedName = database_name + ".dbo.sp_ChequeIssueDetRpt";
                        boTable.Alias = "sp_ChequeIssueDetRpt";
                        objRpt.ReportClientDocument.DatabaseController.SetTableLocation(boTables[0], boTable);
                objRpt.VerifyDatabase();
    http://sourceforge.net/projects/aspchequesprint/files/ChequeIssueDet.rpt/download

    No subreport, only a stored procedure with final two lines are
    print @m_sql
    exec (@m_sql)
    After use generated code in the link above
    Error at boReportDocument.VerifyDatabase();
    Inner Exception : no error
    Message "Logon failed"
    ErrorID : CrystalDecisions.CrystalReports.Engine.EngineExceptionErrorID.LogOnFailed
    HelpLink : null
    stacktrace :  CrystalDecisions.CrystalReports.Engine.ReportDocument.VerifyDatabase()\r\n   at viewReport.Page_Load(Object sender, EventArgs e) 於 d:
    Data
    My Documents
    Visual Studio 2008
    WebSites
    Cheques
    viewReport.aspx.cs: row 1302\r\n   at System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e)\r\n   at System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e)\r\n   at System.Web.UI.Control.OnLoad(EventArgs e)\r\n   at System.Web.UI.Control.LoadRecursive()\r\n   於 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
    TargetSite : {Void VerifyDatabase()}
    string reportPath = report_path + "ChequeIssueDet.rpt";
                boReportDocument = new ReportDocument();
                //**EDIT** Change the path and report name to the report you want to change.
                boReportDocument.Load(reportPath, OpenReportMethod.OpenReportByTempCopy);
                //Create a new Stored Procedure Table to replace the reports current table.
                CrystalDecisions.ReportAppServer.DataDefModel.Procedure boTable =
                new CrystalDecisions.ReportAppServer.DataDefModel.Procedure();
                //boMainPropertyBag: These hold the attributes of the tables ConnectionInfo object
                PropertyBag boMainPropertyBag = new PropertyBag();
                //boInnerPropertyBag: These hold the attributes for the QE_LogonProperties
                //In the main property bag (boMainPropertyBag)
                PropertyBag boInnerPropertyBag = new PropertyBag();
                //Set the attributes for the boInnerPropertyBag
                boInnerPropertyBag.Add("Database", database_name);
                boInnerPropertyBag.Add("DSN", "Cheque");
                boInnerPropertyBag.Add("UseDSNProperties", "False");
                //Set the attributes for the boMainPropertyBag
                boMainPropertyBag.Add("Database DLL", "crdb_odbc.dll");
                boMainPropertyBag.Add("QE_DatabaseName", database_name);
                boMainPropertyBag.Add("QE_DatabaseType", "ODBC (RDO)");
                //Add the QE_LogonProperties we set in the boInnerPropertyBag Object
                boMainPropertyBag.Add("QE_LogonProperties", boInnerPropertyBag);
                boMainPropertyBag.Add("QE_ServerDescription", "Cheque");
                boMainPropertyBag.Add("QE_SQLDB", "True");
                boMainPropertyBag.Add("SSO Enabled", "False");
                //Create a new ConnectionInfo object
                CrystalDecisions.ReportAppServer.DataDefModel.ConnectionInfo boConnectionInfo =
                new CrystalDecisions.ReportAppServer.DataDefModel.ConnectionInfo();
                //Pass the database properties to a connection info object
                boConnectionInfo.Attributes = boMainPropertyBag;
                //Set the connection kind
                boConnectionInfo.Kind = CrConnectionInfoKindEnum.crConnectionInfoKindCRQE;
                //**EDIT** Set the User Name and Password if required.
                boConnectionInfo.UserName = db_username;
                boConnectionInfo.Password = db_password;
                //Pass the connection information to the table
                boTable.ConnectionInfo = boConnectionInfo;
                //Get the Database Tables Collection for your report
                CrystalDecisions.ReportAppServer.DataDefModel.Tables boTables;
                boTables = boReportDocument.ReportClientDocument.DatabaseController.Database.Tables;
                //For each table in the report:
                // - Set the Table Name properties.
                // - Set the table location in the report to use the new modified table
                boTable.Name = "sp_ChequeIssueDetRpt;1";
                boTable.QualifiedName = database_name+".dbo.sp_ChequeIssueDetRpt;1";
                boTable.Alias = "sp_ChequeIssueDetRpt;1";
                boReportDocument.ReportClientDocument.DatabaseController.SetTableLocation(boTables[0], boTable);
                //Verify the database after adding substituting the new table.
                //To ensure that the table updates properly when adding Command tables or Stored Procedures.
                boReportDocument.VerifyDatabase();
                //**EDIT** Set the value for the Stored Procedure parameters.
                string m_curUser = "";
                int spid = Convert.ToInt32(Request.Cookies["login_cookie"]["spid"]);
                queryString = "select * from v_All_Session where SPID=" + spid.ToString();
                //string _connectionString = ConfigurationManager.ConnectionStrings["ChequeConnectionString"].ConnectionString;
                using (SqlConnection connection = new SqlConnection(_connectionString))
                    SqlCommand command = connection.CreateCommand();
                    command.CommandText = queryString;
                    connection.Open();
                    using (SqlDataReader datareader = command.ExecuteReader())
                        if (datareader.HasRows == true)
                            while (datareader.Read())
                                if (datareader["UserID"] != System.DBNull.Value)
                                    m_curUser = datareader["UserID"].ToString();
                        datareader.Close();
                    connection.Close();
                boReportDocument.SetParameterValue("@UserID", m_curUser);
                if (string.IsNullOrEmpty(Session["fm_CoCode"].ToString()))
                    boReportDocument.SetParameterValue("@fm_CoCode", Session["fm_CoCode"].ToString());
                if (string.IsNullOrEmpty(Session["to_CoCode"].ToString()))
                    boReportDocument.SetParameterValue("@to_CoCode", Session["to_CoCode"].ToString());
                if (string.IsNullOrEmpty(Session["fm_BankACNo"].ToString()))
                    boReportDocument.SetParameterValue("@fm_BankACNo", Session["fm_BankACNo"].ToString());
                if (string.IsNullOrEmpty(Session["to_BankACNo"].ToString()))
                    boReportDocument.SetParameterValue("@to_BankACNo", Session["to_BankACNo"].ToString());
                if (string.IsNullOrEmpty(Session["fm_BatchNo"].ToString()))
                    boReportDocument.SetParameterValue("@fm_BatchNo", Session["fm_BatchNo"].ToString());
                if (string.IsNullOrEmpty(Session["to_BatchNo"].ToString()))
                    boReportDocument.SetParameterValue("@to_BatchNo", Session["to_BatchNo"].ToString());
    Edited by: Mathew_666 on Jul 19, 2011 4:27 AM
    Edited by: Mathew_666 on Jul 19, 2011 4:28 AM

  • Failed to load database information. When previewing report in CMC

    I attempting to load reports that are from our accounting program.  The account program uses a ProvideX driver and every report I add to the CMC displays the same results
    Unable to retrieve Object.
    Failed to load database information. File xxxxxxxxx.rpt
    When I am listing my connection source for the report I have the following selected:
    Use custom database logon information specified here
    For the driver I am listing
    MAS 90 4.0 ODBC Driver
    Server = SOTAMAS90
    DATABASE= ABC
    USER= bmb
    Password= password
    If I have any other settings or if I just choose standard ODBC I get the following results
    Unable to retrieve Object.
    The database logon information for this report is either incomplete or incorrect.
    I can view reports fine from my Access Database but the SOTASMAS90 is causing problems.
    Any ideas? 
    Thanks in advance!
    Brian

    I tried using the standard ODBC connection and I tried placing MAS 90 4.0 ODBC Driver in the custom driver. 
    If I go to my ODBC connections in my Administrative tools and select Add driver, the driver name that displays is MAS 90 4.0 ODBC Driver.  So I was thinking that the CMC would be able to determine the driver if I used the same naming convention that was used by Windows.
    I have some screenshots that I uploaded if you want to take a look.  I figure this should just work. 
    Shows when I have selected the standard ODBC
    http://i36.photobucket.com/albums/e31/bberrelez/image1.jpg
    Shows when I specify a custom driver
    http://i36.photobucket.com/albums/e31/bberrelez/image2.jpg
    Displays the drivers I am able to choose from within CMC
    http://i36.photobucket.com/albums/e31/bberrelez/image3.jpg
    If I were to create a new ODBC connection in Windows
    http://i36.photobucket.com/albums/e31/bberrelez/ODBC.jpg
    Thanks helping me with this. I appreciate it!

  • How to hide Database Logon option when scheduling Crystal Report in BOE?

    Hi All,
    For security reason, we are try to hide the Database Logon option in Crystal Report Schedule page in InfoView.
    There is option in CMC which we can configure the default Database logon option so that users do not have to enter the logon everytime they view or schedule the report.  However, we are looking to hide this option completely.
    Does anyone know if there is a security setting which can hide the option from specific users?
    Thanks,
    Bobby

    Hi Bobby,
    As Jorge informed that there is no method available within CMC to hide database logon option when scheduling or viewing a Crystal Report in the Info view. This is very much true.
    But as you also mentioned that you don't want your users to enter the database logon credentials evertime they view or schedule a crystal report, there is one setting in CMC which we can do to avoid prompt for database logon credentials.
    CMC - Home - Go to that specific crystal report - Click Process tab - Click the sub-tab 'Database' and at the bottom of the page there is an option "Use same database logon as when report is run". Check this option after providing the database credentials and click UPDATE.
    Now whenever users try to view or schedule this specifc crystal report they won't be prompted for the database logon credentials.
    Regards,
    Venkat

  • Use same database logon as when report is run

    Is there a way to set the option for "When viewing report" to "Use same database logon as when report is run" for all reports?

    If scheduling we have schedule manager in XIR2 which will do a folder at a time, it's been added to the CMC in 3.x I believe.
    For running the reports I think you would need to use the [SDK|/community [original link is broken]; if if you wanted to modify a bunch of reports at the same time, or use the publishing wizard to publish a bunch of them (no use if the reports are already uploaded)
    Regards,
    Tim

  • Xcelsius - Database logon failed. (LO 26603)

    Hi Expert,
    I have a error when run .swf file.
    The first, I create new query from SAP toolbar integration in Crystal Report 2008. The Crystal Query is called from a BW Query . The query have not variables, the data get directly from BW Query.
    I saved Crystal Report file into BOE (File -->Save -->Enterprise, not save on BW).
    In Infoview, I setup schedule for this .rpt file with information database logon below (default as inform in Set Database Location of Crystal Report):
    - Database server: xxx.xxx.xxx.xxx (BW server)
    - User name: User in BW
    - Password: Password in BW
    In Xcelsius, I use Live Office to get data from crystal on BOE to Excel sheet on Xcelsius.
    In data-->Connection, I changed <server:8080> by <IP BOE System:8080>.
    When I preview or export to swf file, a message box appear require input user name and password of BW server (Database logon). After I input correct password, a message box User Identification appear, I input System, User name, Password on BOE server and chose Authentication Enterprise. And final, I get error message "  Database logon failed. (LO 26603)".
    I try opening Crystal Report file on Infoview and Refresh data, I also input database logon by BW User, the data refresh correctly.
    Why do crystal report file update data from BW correct, while .swf file is not and return error Database Logon failed.
    Please explain for me what step I missed to get data through Live Office.
    Thanks

    Hi Priya,
    Thanks for your support.
    I have set the default credentials in database configuration.
    But my dashboard still can't work. When I preview dashboard, A prompt for database logon information appear, I can logon sucess and refresh data. But after I logon username and password on BOE for BOE User Identification with Authentication Enterprise, I still get error " Database logon failed".
    Who can explain for me what steps I miss.
    Thanks

  • CRVS2010 Beta 2 - "Database Logon failed" Error, after Upgrade

    Hi,
    Generally: we are using the Crystal Reports in combination with a DataSet, that is filled during runtime and pushed to the report, using "SetDataSource". The Project is an ASP .NET 3.5 Project, published on our server.
    I upgraded my development-machine to CRVS2010 (installed both packages - the CRVS for VS 2010 and the runtime) last week and changed some fields in the Report. The DataSet was left unchanged. Everything is working well on my development-machine, but when I publish the Project to our server, I get an "Databse Logon failed" Error, when I want to create my Report. The CRVS2010 Beta 2 redist Runtime is installed on our server. Here is the code, we use:
    // create new Report
    var report = new Reports.repMyReport();
    // DataSource ds was filled correctly (we checked with export to XML
    report.SetDataSource(ds);
    // Set several Parameters to Report
    report.SetParameterValue("test", "test");
    // Export Report to PDF-Format and open in Browser
    report.ExportToHttpResponse(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat, Response, false, "reportName.pdf");
    Response.End();
    The error I get is:
    Database logon failed.
    [COMException (0x8004100f): Database logon failed.]
       CrystalDecisions.ReportAppServer.Controllers.ReportSourceClass.Export(ExportOptions pExportOptions, RequestContext pRequestContext) +0
       CrystalDecisions.ReportSource.EromReportSourceBase.ExportToStream(ExportRequestContext reqContext) +260
    [LogOnException: Database logon failed.]
       CrystalDecisions.ReportAppServer.ConvertDotNetToErom.ThrowDotNetException(Exception e) +325
       CrystalDecisions.ReportSource.EromReportSourceBase.ExportToStream(ExportRequestContext reqContext) +315
       CrystalDecisions.CrystalReports.Engine.FormatEngine.ExportToStream(ExportRequestContext reqContext) +650
       CrystalDecisions.CrystalReports.Engine.ReportDocument.ExportToStream(ExportOptions options) +98
       CrystalDecisions.CrystalReports.Engine.ReportDocument.ExportToHttpResponse(ExportOptions options, HttpResponse response, Boolean asAttachment, String attachmentName) +98
       CrystalDecisions.CrystalReports.Engine.ReportDocument.ExportToHttpResponse(ExportFormatType formatType, HttpResponse response, Boolean asAttachment, String attachmentName) +124
       SprintBoxWeb.BuchungDruck.Page_Load(Object sender, EventArgs e) in D:\Projects\sprnt_erp\SprintBoxWeb\BuchungDruck.aspx.cs:32
       System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +14
       System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +35
       System.Web.UI.Control.OnLoad(EventArgs e) +99
       System.Web.UI.Control.LoadRecursive() +50
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +627
    I already tried everything, found googling the web and/or searching this forum:
    e.g.: perform "verify Database" on all Reports and map the DataSet.xsd again to the Report
    Is that a known issue on the Beta and we should wait for the RC, or does anyone have an idea how to fix that one?
    This error is really annoying!
    Many thanks for your help.
    kind regards
    Reinhard

    Dear Ludek,
    Many thanks for your quick reply. Currently, I have to finish some other things. I will try your ideas next week and give you some feedback then, to keep you informed.
    best regards,
    Reinhard

  • Live Office: Database logon failed error

    Please help...Live Office problem...
    Am working in Xcelsius 2008.
    Here's what I'm trying to do:
    1. I set up a Crystal Report using a Stored Procedure as the data provider.
    2. The Stored Procedure has a parameter built into it.
    3. When the report is refreshed within Crystal, the prompt dialog box is displayed; I fill in the desired value, and run. Everything comes back fine.
    4. Crystal Report is exported to the repository.
    5. In Excel, I inserted the Crystal Report using Live Office. It shows up as a Live Office object just fine.
    6. I bound an Excel cell to the prompt; when you change the value in the bound cell, the Live Office object refreshes and displays the correct results.
    7. In Xcelsius, I imported the Excel spreadsheet.
    8. I set up a Text component that is bound to the cell containing the parameter value. Also set up a Grid to display the results, and a Connection Refresh button to call the refresh. Added a Live Office Data Connection pointing to the Web Service URL for the report. 
    Note: When in Designer mode, if the value of the bound cell is changed, the results in the grid change accordingly.
    9.  When in Preview mode (or generated swf), if the Refresh button is pressed, a "User Identification" dialog box appears asking me to log on. The values it asks for are: System, User Name, Password, and Authentication.  I enter the same credentials as are within the Live Office settings in Excel, (which are working correctly), but receive an error "soapenv:Server.generalException: Database logon failed.".
    Note - all the id's are synced up - Business Objects, Database, etc.
    I've tried all kinds of combinations, but nothing gets me past this error. If I use any other server than the system one, the error message is "soapenv:Server.generalException: Server XXXXX not found or server may be down".
    I've noticed that in Excel directly, when I open the spreadsheet and refresh the Live Office object, I am prompted to log on to the database where the stored procedure is being executed. This dialog box does not appear once the Excel sheet has been imported into Xcelsius. One of the combinations I tried in the "User Identification" dialog box was the name of the database server, that didn't work either.
    I also tried creating the Live Office object directly within the Excel spreadsheet in Xcelsius, but then I was unable to bind the prompt value. Could never get the Live Office/Properties menu to appear.
    Ideas? Thoughts?
    Thanks in advance!
    Stephanie

    Got it!
    Here's what I had to do...
    In the CMC, under Object/Process/Database for the Crystal Report -
    which says...
    "Set the default information for logging onto the data source(s) automatically whenever the report is run."
    The Database Connection option had to be set to "Use custom database logon information specified here" and
    the When Viewing Report option set to "Use same database logon as when report is run".
    Then everything works fine - prompts appear, and Xcelsius passes the log on information to the database correctly. Stored procedure executes and returns the correct results.
    Thanks to everyone for their help!
    Stephanie

Maybe you are looking for