Crystal Reports failed to open the connection

随声附和 提交于 2020-12-16 05:17:30

问题


I am developing a desktop software which is creating proposals and invoices. I am storing my database (MySql) in a remote server. Everything is working perfectly fine in my PC which i am using for coding.

On client machine I can add,update and delete records without any problem. But when i try to open a record in then I am facing with an error below.

I was created the report in VB.NET but when I face with the error than I opened the rpt file in Crystal Reports XI Release 2 and updated data source location, verified database and save the file. Some part of my code is :

ElseIf Me.Text = "Tekliflere Gözat" Then
            Form16.Text = "Teklif Detayları:"

            Dim strReportPath As String
            Dim rptDoc As CrystalDecisions.CrystalReports.Engine.ReportDocument
            strReportPath = My.Application.Info.DirectoryPath & "\Teklif.rpt"
            rptDoc = New ReportDocument
            rptDoc.Load(strReportPath)
            rptDoc.SetDatabaseLogon("USER_NAME", "PASSWORD", "SERVER_IP", "DB_NAME")
            Form16.CrystalReportViewer1.ReportSource = rptDoc


            Form16.CrystalReportViewer1.SelectionFormula = "{teklif1.teklifno} =" & ListView1.SelectedItems(0).Text
            Form16.CrystalReportViewer1.Refresh()
            Form16.CrystalReportViewer1.RefreshReport()
            Form16.Show()
            Me.Close()

Crystal reports Failed to open the connection Could you please advise.
Thank you.
Regards
Oguz


回答1:


I've found the solution. But first have to look at the casue. While connecting to a remote database via my software everthing is working fine. But when I was designing a report in CR, I created a connection in database expert menu. So that means locally I am describing to CR that where and how to connect. But when I install my software with all necessery components to the client machine CR report files searching the connection criteria and as a matter of course it can not find it in client machine.

So the solution is to install Mysql ODBC Connector to the client machine and configure it with the same settings in my PC. Or as an alternative solution, define all connection and database settings programatically in your code.

Hope this helps.



来源:https://stackoverflow.com/questions/28119692/crystal-reports-failed-to-open-the-connection

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!