简体   繁体   中英

Crystal Reports “Failed to open the connection” error in ASP.NET

I have ASP.NET (C#) application which uses SAP Crystal Reports. In Visual Studio everything works well, but when I deploy it to IIS the following error occurs:

"Failed to open the connection. Failed to open the connection 'report name'.rpt".

I have changed my reports to use System DSN now the previous error gone but it generates following error:

"Database Logon Failed"

Any suggestions?

    Dim db As New _yourdbcontext()
    Dim cr As New ReportDocument
    cr.Load(Server.MapPath("~/yourreport.rpt"))
    cr.SetDataSource(db.yourtable.ToList())
    CrystalReportViewer1.ReportSource = cr

dont forget set user and password in crystal report and model connection

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM