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