Results 1 to 3 of 3

Thread: [RESOLVED] Crytal report logon failed

  1. #1

    Thread Starter
    Frenzied Member usamaalam's Avatar
    Join Date
    Nov 2002
    Location
    Karachi
    Posts
    1,308

    Resolved [RESOLVED] Crytal report logon failed

    Hello Everybody,

    My application is developed with VS 2005 and crystal reports 10. It works fine on my local machine but when I try to run the app on the server where I deployed it, it uses the design time login credentials and hence doesn't allow me to see the report and throws following exception on the report page.

    Logon failed. Details: ADO Error Code: 0x Source: Microsoft OLE DB Provider for SQL Server Description: Login failed for user 'sa'. SQL State: 42000 Native Error: Error in File C:\WINDOWS\TEMP\AlphaListing {1C4A8624-64C0-4721-B98D-68CC729163CE}.rpt: Unable to connect: incorrect log on parameters.

    I am passing log on parameters using code and the username is not 'sa' which crystal report is trying to connect with. Here's the code as to how I am trying to show the report.

    Code:
                    CrystalDecisions.CrystalReports.Engine.ReportDocument reportDoc = new CrystalDecisions.CrystalReports.Engine.ReportDocument();
    
                    string serverName = Sterling.JIDB.BusinessLogicLayer.DatabaseInfo.GetServerName();
                    string databaseName = Sterling.JIDB.BusinessLogicLayer.DatabaseInfo.GetDatabaseName();
                    string userName = Sterling.JIDB.BusinessLogicLayer.DatabaseInfo.GetUserName();
                    string password = Sterling.JIDB.BusinessLogicLayer.DatabaseInfo.GetPassword();
    
                    Response.Write(userName + "--" + password + "--" + databaseName + "--" + serverName);
    
                    reportDoc.Load(Server.MapPath("AlphaListing.rpt"));
                    reportDoc.Refresh();
    
                    reportDoc.SetDatabaseLogon(userName, password, databaseName, databaseName, true);
                    reportDoc.Refresh();
                    //reportDoc.SetDatabaseLogon(userName, password, databaseName, databaseName, true);
    
                    rptAlphaListing.ReportSource = reportDoc;
                    
                    reportDoc = null;
    Any ideas??

    Thanks.

  2. #2
    Frenzied Member
    Join Date
    Nov 2001
    Location
    Mass USA
    Posts
    1,674

    Re: Crytal report logon failed

    yeah I think you need to loop through your tables like the code in this thread:

    http://www.vbforums.com/showthread.php?t=519097

  3. #3

    Thread Starter
    Frenzied Member usamaalam's Avatar
    Join Date
    Nov 2002
    Location
    Karachi
    Posts
    1,308

    Re: Crytal report logon failed

    Yes, I looped through all the tables and it works.

    Thanks.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width