Click here to Skip to main content
15,911,848 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Dear Frnds,

I am working on Crystal Report,

When I export to PDF its showing Database logon failed error.

My code is
C#
string sPDFReportFile = "Payslip-" + _common.Utility.ToString(cmbMonth.Items[cmbMonth.SelectedIndex].Value) + Utility.ToString(cmbYear.Items[cmbYear.SelectedIndex].Value) + "-" + _common.Utility.ToString(Session.SessionID) + "." + Utility.ToString(filetype).Trim();
CrystalDecisions.Shared.DiskFileDestinationOptions dfdoReport = new CrystalDecisions.Shared.DiskFileDestinationOptions();
dfdoReport.DiskFileName = Request.PhysicalApplicationPath + @"TempReports\" + sPDFReportFile;
ReportDoc.ExportOptions.ExportDestinationType = CrystalDecisions.Shared.ExportDestinationType.DiskFile;
if (filetype == "doc")
    ReportDoc.ExportOptions.ExportFormatType = CrystalDecisions.Shared.ExportFormatType.RichText;
else if (filetype == "pdf")
    ReportDoc.ExportOptions.ExportFormatType = CrystalDecisions.Shared.ExportFormatType.PortableDocFormat;

ReportDoc.ExportOptions.DestinationOptions = dfdoReport;
ReportDoc.Export();
ReportDoc.Close();
ReportDoc.Dispose();

return Utility.ToString(sPDFReportFile);
Posted
v2

You need to apply logon details at runtime.
C# Crystal Reports Dynamic Logon parameters[^]
 
Share this answer
 
Have a look at this question - crystal report error Database Logon Failed[^] and its answers.
 
Share this answer
 
Open crystal report and verify it again and paste in your server file...
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900