0
votes

We have been working on this issue for days and can't seem to solve it. Wondering if someone else could be of some help. We have a .NET application that uses:

CrystalDecisions.CrystalReports.Engine Version: 12.0.2000.0

CrystalDecisions.Shared Version: 12.0.2000.0

We use a System DSN to connect to Sql Server on the prod server the application is deployed. It uses Sql Server version 6.00.6002.18005 as the data source. It works just fine. The server is a Windows Server Enterprise SP2, 32 bit.

When we deploy it on the test box, which is Windows Server 2008 R2 64 bit. The System Dsn Sql Server version is 6.01.7601.17514. I installed the update:

SAP Crystal Reports, developer version for Microsoft Visual Studio SP5 - MSI (64bit)

Then we are using: CrystalDecisions.CrystalReports.Engine Version: 13.0.2000.0 CrystalDecisions.Shared Version: 13.0.2000.0

I am getting a log on error: CrystalDecisions.CrystalReports.Engine.LogOnException: Database logon failed.

Here is the .Net code that I am using:

 using (ReportDocument rd = new ReportDocument())
        {
            if (reportType == "Current")
                rd.Load(Server.MapPath("~/bin/Reports/MyLoan_MonthlyBillingStatement_CurrentMonth.rpt"));
            else
                rd.Load(Server.MapPath("~/bin/Reports/MyLoan_MonthlyBillingStatement_History.rpt"));


            DataSourceConnections dsc = rd.DataSourceConnections;


            IConnectionInfo connInfo = dsc[0];
            connInfo.SetLogon("creds here", "creds here");
            rd.SetParameterValue("month", month);
            rd.SetParameterValue("year", year);                

This is where the error hits:               
                oStream =     (MemoryStream)rd.ExportToStream(ExportFormatType.PortableDocFormat);

            string filename = string.Format("{0}_{1}.pdf", loanId, reportDate.ToString("m_d_yyyy"));


            Response.Buffer = true;
            Response.Clear();
            Response.AddHeader("content-disposition", "attachment; filename=" + filename);
            Response.ContentType = "application/pdf";
            Response.BinaryWrite(oStream.ToArray());


            oStream.Flush();
            oStream.Close();
        }

We have confirmed that the port is open and we can telnet into the sql server that is used in the system dsn. Also our Crystal Reports developer took the Crystal Report and ran it (independently, not in the .net application) and it connected and worked just fine. I am stumped. I believe it is an issue with crystal reports dll's and the version of sql server in the system dsn. Any help would be greatly appreciated.

Thanks! Brian

1
Which version of Visual Studio ?Lan
We are using VS 2012.Loganj99
You need to use Crystal 13 not 12. I don't know if this could help , but this is what SAP says . Also you can try to reset your report connection using this tool: r-tag.com/Pages/CRDataSource.aspx (use the trial version)Lan
I cannot check this right now , but as far as I remember there is a method setdatabaselogoninfo ( or similar) for ReportDecoment class. Did you try to use it instead of connection info method ?Lan

1 Answers

1
votes

The server is 64 bit. I installed the 64 bit Crystal Reports driver update ( I had previously installed the 32 bit update). In IIS app pool, there is a setting under advance settings, Enable 32 bit applications. It was set to true. I changed it to false. Then it worked.