locked
Login failed with Crystal Report RRS feed

  • Question

  • User-854865092 posted

    Hi,

     I have implemented a console application which takes arguments from our web application and generated and print reports. Reports are made using Crystal Reports.

    ConnectionInfo myConnectionInfo = new ConnectionInfo();

    myConnectionInfo.ServerName = serverName;
    myConnectionInfo.DatabaseName = databaseName;
    myConnectionInfo.UserID = userID;
    myConnectionInfo.Password = password;
    myConnectionInfo.IntegratedSecurity = false;

    foreach (CrystalDecisions.CrystalReports.Engine.Table crTable in rptDoc.Database.Tables)
    {
    TableLogOnInfo crtableLogoninfo = new TableLogOnInfo();
    crtableLogoninfo.TableName = crTable.Name;
    crtableLogoninfo.ConnectionInfo = myConnectionInfo;
    crTable.ApplyLogOnInfo(crtableLogoninfo);

    }
    rptDoc.SetDatabaseLogon(userID, password, serverName, databaseName);

     

    rptDoc.ExportToDisk(ExportFormatType.PortableDocFormat, Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "ticketreceipt.pdf"));

     

    I have used the above method to authenticating crystal report upon SQL server. and it  is working well on all servers which has SQL 2008.

     

    Now on the new server with SQL 2012 this same code is giving "Databse login failed" error. Though this same code is working fine with SQL 2008 and SQL 2012 locally.

     

    After that I have also used the method to fill dataset with required data and then assign it to Report but it is not working.

     

    Please help me in this, I thanks to all in advance.

    Friday, September 21, 2012 9:06 AM

Answers

  • User1100692814 posted

    Try changing the connection provider in your report to "SQLOLEDB"

    Also, check out this article as it helped me. If you are still having issue, please post some code, especially surrounding the creation of the connection to the database.

    Hope this helps.

    /D

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, September 21, 2012 9:59 AM
  • User1196771204 posted

    hi alendonold,

    the "Databse login failed" error message simply means that you do not create a db user for your database. Please login to your SQL 2012 database, create a db user with dbo_owner permission and then, please make the necessary changes to the connection string. Everything will certainly work.

    As a rule of thumb, if you can connect to your SQL Database via SQL Management Studio Tool, you should be able to connect via your connection string. You just have to use EXACTLY the same details.

    Please just remember that the issue that you face now has completely nothing to do with Crystal Report. It is just about SQL Server permission and connection string issue.

    Please mark this response as an "answer" if it helps you. Thanks heaps! 

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, September 22, 2012 12:16 AM

All replies

  • User1100692814 posted

    Try changing the connection provider in your report to "SQLOLEDB"

    Also, check out this article as it helped me. If you are still having issue, please post some code, especially surrounding the creation of the connection to the database.

    Hope this helps.

    /D

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, September 21, 2012 9:59 AM
  • User1196771204 posted

    hi alendonold,

    the "Databse login failed" error message simply means that you do not create a db user for your database. Please login to your SQL 2012 database, create a db user with dbo_owner permission and then, please make the necessary changes to the connection string. Everything will certainly work.

    As a rule of thumb, if you can connect to your SQL Database via SQL Management Studio Tool, you should be able to connect via your connection string. You just have to use EXACTLY the same details.

    Please just remember that the issue that you face now has completely nothing to do with Crystal Report. It is just about SQL Server permission and connection string issue.

    Please mark this response as an "answer" if it helps you. Thanks heaps! 

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, September 22, 2012 12:16 AM