locked
ODBC Error RRS feed

  • Question

  • User-614943948 posted

    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?

    Monday, August 17, 2015 3:28 AM

All replies

  • User-219423983 posted

    Hi maverick786us,<!--?xml:namespace prefix = "o" ns = "urn:schemas-microsoft-com:office:office" /--><o:p></o:p>

    I have found some similar links about the “ODBC Driver Manager error”, the solutions the provide you could take a look.<o:p></o:p>

    http://stackoverflow.com/questions/2137618/why-error-odbc-driver-manager-data-source-name-not-found-works-fine-on<o:p></o:p>

    http://scn.sap.com/thread/3316934<o:p></o:p>

    https://support.microsoft.com/en-us/kb/306345<o:p></o:p>

    I hope it’s useful to you.<o:p></o:p>

    Best Regards,<o:p></o:p>

    Weibo Zhang<o:p></o:p>

    Monday, August 17, 2015 10:07 AM
  • User2053451246 posted

    I have created a user DSN
    Have you tried with a System DSN instead?  When your application is running it's not using your credentials, it's using the credentials of the Application Pool, which is a different user.

    Monday, August 17, 2015 11:53 AM
  • User-614943948 posted

    maverick786us

    I have created a user DSN

    Have you tried with a System DSN instead?  When your application is running it's not using your credentials, it's using the credentials of the Application Pool, which is a different user.


     

    Yes I created a System DSN too, and the result is still the same. The surprise part is, we are sharing this source code, and crystal reports in 3 different PCs which are bind using VSS and in 2 PCs it working fine, in the 3rd PC the issue is there

    Tuesday, August 18, 2015 12:43 AM