I am using Crystal Reports 9.0. In order to establish connectivity with SQL Server 2008, I have created a user DSN, selected the server path, the database and its credentials. The connection was successful, When I open the any report in Crystal Reports editor, I am able to work with the database.
But when I call the report in C#
public static void ExportToPdf(ReportDocument selectedReport, ArrayList PrmListName, ArrayList PrmListValue, string reportName, CrystalDecisions.Shared.ExportFormatType eft) { ---------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------- selectedReport.ExportToHttpResponse(eft, HttpContext.Current.Response, true, reportName); ---------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------- }
This is the exception that is coming.
{CrystalDecisions.CrystalReports.Engine.LogOnException: Logon failed. Details: IM002:[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified Error in File C:\Windows\TEMP\rptE2Cert {AE5834BB-2936-43B7-9DF6-A5DDCA9D73AE}.rpt: Unable to connect: incorrect log on parameters. ---> System.Runtime.InteropServices.COMException (0x8004100F): Logon failed. Details: IM002:[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified Error in File C:\Windows\TEMP\rptE2Cert {AE5834BB-2936-43B7-9DF6-A5DDCA9D73AE}.rpt: Unable to connect: incorrect log on parameters. at CrystalDecisions.ReportAppServer.Controllers.ReportSourceClass.Export(ExportOptions pExportOptions, RequestContext pRequestContext) at CrystalDecisions.ReportSource.EromReportSourceBase.ExportToStream(ExportRequestContext reqContext) --- End of inner exception stack trace --- at CrystalDecisions.ReportAppServer.ConvertDotNetToErom.ThrowDotNetException(Exception e) at CrystalDecisions.ReportSource.EromReportSourceBase.ExportToStream(ExportRequestContext reqContext) at CrystalDecisions.CrystalReports.Engine.FormatEngine.ExportToStream(ExportRequestContext reqContext) at CrystalDecisions.CrystalReports.Engine.ReportDocument.ExportToStream(ExportOptions options) at CrystalDecisions.CrystalReports.Engine.ReportDocument.ExportToHttpResponse(ExportOptions options, HttpResponse response, Boolean asAttachment, String attachmentName) at CrystalDecisions.CrystalReports.Engine.ReportDocument.ExportToHttpResponse(ExportFormatType formatType, HttpResponse response, Boolean asAttachment, String attachmentName) at Gaselec.GenerateReport.ExpCRToPDF.ExportToPdf(ReportDocument selectedReport, ArrayList PrmListName, ArrayList PrmListValue, String reportName, ExportFormatType eft) in D:\Projects\NewGE3\APP_CODE\BLL\ExpCRToPDF.cs:line 117}
Can someone tell me solution to this issue? When I am able to use database in the Crystal Reports, while using it in database expert. Why is it happening in the code?